generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Help with a Thermal Script

Previous Thread :: Next Thread 
grunt1994 is not online. grunt1994
Joined: 04 Oct 2008
Total Posts: 1201
27 May 2016 09:04 AM
I was wondering if someone could help me with this script... It makes things look thermal..ish, It works until it comes back to ThermalOff. It won't "turn off"... Theres no output and i'm not sure if i'm just being stupid but i can't figure it out for the life of me

local Player = game.Players.LocalPlayer
local Avatar = Player.Character
local Mouse = Player:GetMouse()

local Hold = nil

local Humanoid = Avatar:WaitForChild("Humanoid")


function ThermalOff()
for i, empty in pairs(Player.PlayerGui:GetChildren()) do
if empty.className == "SelectionBox" then
empty:Remove()
Player.PlayerGui.Extra.Thermal.Visible = false
end
end
end

Player:GetMouse().KeyDown:connect(function(Key)
if (Hold ~= nil) then return end
if (string.upper(Key) ~= "X") and (string.lower(Key) ~= " ") then return end
Hold = true

if (string.lower(Key) ~= " ") then
for i, players in pairs(game.Players:GetChildren()) do
for i, boxem in pairs(players.Character:GetChildren()) do
if (boxem.className == "Part") then
local a = Instance.new("SelectionBox")
a.Color = BrickColor.new("Lime green")
a.Parent = Player.PlayerGui
a.Adornee = boxem
Player.PlayerGui.Extras.Thermal.Visible = true

Humanoid.WalkSpeed = 15
end
end
end

else
ThermalOff()

Humanoid.WalkSpeed = 20

end

wait(0.5)

Hold = nil
end)

Humanoid.Changed:connect(function()
if (Humanoid.WalkSpeed > 15) and (Hold == nil) then ThermalOff() end
end)
Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
27 May 2016 09:29 AM
I couldn't really tell quite what it was doing. I removed deprecated methods and thing, and tidied it up a bit. Let me know if it works.

#code
local Player = game.Players.LocalPlayer
local Avatar = Player.Character or Player.CharacterAdded:wait() -- This waits for the character to load.

local Hold = nil

local On = false

local Humanoid = Avatar.Humanoid -- Humanoid is already present when the character loads, or so I'm told.

local function ThermalOff()
for i, empty in pairs(Player.PlayerGui:GetChildren()) do
if empty.ClassName == "SelectionBox" then
empty:Destroy()
end
end
Player.PlayerGui.Extra.Thermal.Visible = false
end

game:GetService("UserInputService").InputBegan:connect(function(InputObject, GameProcessedEvent)
if not GameProcessedEvent and InputObject.KeyCode == Enum.KeyCode.X then
-- I could tell very well what you were doing, but you can obviously modify this if you like.
if (Hold) then return end
Hold = true
if On then
ThermalOff()
Humanoid.WalkSpeed = 20
On = true
else
for i, players in pairs(game.Players:GetChildren()) do
for i, boxem in pairs(players.Character:GetChildren()) do
if (boxem.className == "Part") then
local a = Instance.new("SelectionBox")
a.Color = BrickColor.new("Lime green")
a.Parent = Player.PlayerGui
a.Adornee = boxem
Player.PlayerGui.Extras.Thermal.Visible = true
end
end
end
Humanoid.WalkSpeed = 15
On = true
end

end
wait(0.5)
Hold = nil
end)

Humanoid.Changed:connect(function()
if (Humanoid.WalkSpeed > 15) and (On) then ThermalOff() end
end)


Report Abuse
grunt1994 is not online. grunt1994
Joined: 04 Oct 2008
Total Posts: 1201
27 May 2016 11:58 AM
Awesome, it works the once but i'm sure i can do something about that :) Really appreciate it
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image