Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Very unusual Hopperbin glitch, anyone know how to fix?

Asked by
Xoqex 75
10 years ago

So, yet again, another tool question. It works perfectly in game and in studio...Unless you die, if you die its broken until you rejoin. There are no output errors at all.

local tool = script.Parent --The hopperbin which the script is in.
local player = game.Players.LocalPlayer --The local player. (Make sure the script is a local script)
local char = player.Character or player.CharacterAdded:wait() --The character of the player.
repeat wait() until char
local hum = char:WaitForChild("Humanoid")

tool.Selected:connect(function(mouse) --Fires the function when the event is triggered.
        mouse.Button1Down:connect(function() --Fires the function when the event is triggered.
         if char:FindFirstChild("HumanoidRootPart") and not char.HumanoidRootPart:FindFirstChild("Fire") then --Simplified. The conditions are exactly the same, just shorter.
            hum.WalkSpeed = 0
            local f = Instance.new("Fire", char.HumanoidRootPart)
            f.Color = Color3.new(0.4)
            f.SecondaryColor = Color3.new(0, 0, 0)
            f.Heat = 0
            f.Size = 0
            while (f.Size < 9.9) do
            f.Size = f.Size + 0.2
             wait(0.1)
            end
            hum.WalkSpeed = 26
            hum.MaxHealth = 150
            hum.Health = hum.MaxHealth
            wait(10)
            hum.WalkSpeed = 16
            hum.MaxHealth = 100
            hum.Health = hum.MaxHealth
            while wait(0.1) do
            f.Size = f.Size - 0.2
            if f.Size == 2 then f:Destroy() 
                end
            end 
        end
    end)
end)


I have a feeling it may be a format error, but I honestly have no idea.

Answer this question