No one's helped and it's fallen down the list and I really need help with it ASAP.
So this happens to some of my tools, they work perfectly in studio and don't do anything in game.
I checked the output in game via developer console and got nothing.
Here's my script:
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 --The character of the player. local hum = char.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") ~= nil and char.HumanoidRootPart:FindFirstChild("Fire") == nil then 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 char.Torso.Anchored = true while (f.Size < 9.9) do f.Size = f.Size + 0.2 wait(0.1) end wait(3) while wait(0.1) do f.Size = f.Size - 0.2 if f.Size == 2 then f:Destroy() char.Torso.Anchored = false end end end end) end)
Any help would be appreciated.
Usually when this happens to me, I usually put in some code to wait for the character and humanoid to become available.
This should guarantee that the code will run when the script is able to find the player's character and humanoid.
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. 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 char.Torso.Anchored = true while (f.Size < 9.9) do f.Size = f.Size + 0.2 wait(0.1) end wait(3) while wait(0.1) do f.Size = f.Size - 0.2 if f.Size == 2 then f:Destroy() char.Torso.Anchored = false end end end end) end)