Studio crashes when equipping a tool

When I equip a certain tool, my studio crashes, I tried it with another tool, and it didn’t crash, but the tool that is making me crash, has a animation that plays when equipped,

Things I’ve tried

Removed data store scripts,

Removed the tools animation,

Re-opened studio,

When it crashes, the output says

“StartProcessException”
“Uploading crash analytics”
“Done uploading crash analytics”

Can you show us the script? Can’t help much without it.

Its a pushup Tool,
Heres The Script Inside The Tool.

local player = game:GetService("Players").LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local a = char:WaitForChild("Humanoid")
local pushupR = a:LoadAnimation(script.Parent:WaitForChild("PushupReady"))
local pushupS = a:LoadAnimation(script.Parent:WaitForChild("PushupStay"))
local pushup = a:LoadAnimation(script.Parent:WaitForChild("Pushup"))

local number = 0
local push = true

local tool = script.Parent

tool.Equipped:Connect(function()
	
	
	a.WalkSpeed = 0
	pushupR:Play()
	pushupS:Play()
end)

tool.Unequipped:Connect(function()
	pushupS:Stop()
	wait(0.2)
	a.WalkSpeed = 16
end)

tool.Activated:Connect(function()
	if push == true then
		push = false
		pushup:Play()
		wait(1)
		number = number + 1
		push = true
	end
end)

while true do
	wait(0.1)
end


Keep in mind there’s 3 animations in the tool.

Why are you doing

while true do
    wait(0.1)
end

at the bottom

whoops, That was for a GUI that i was going to use, i changed my mind and deleted the GUI and everything in the script that has to do with it, except for that…

Also wait has been superseded by task.wait() highly recommend using it instead when needing to yield the current thread.

1 Like