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 |
|
|
|
| 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
|
  |
| 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 |
|
|