Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Help my localscript is working and not working sometimes Anybpdy?

I was confused about my script because it said my Part [MeshPart1] is not valid but the true name can someone help me with this, please? Sorry For My Grammar

Script Doesn't work https://gyazo.com/1574276b5eebc6908e13ad30df9d1b75 Script Work https://gyazo.com/9cf20bf978877690355c096234df8c8e

player = game.Players.LocalPlayer
repeat wait(0.001) until player.Character
character = player.Character
CanSwing = true

animation = character.Humanoid:LoadAnimation(script.Parent.Animation)
Parent = script.Parent	

script.Parent.Activated:Connect(function()
	
	if CanSwing == true then
		CanSwing = false
		animation:Play()
		local plr = game.Players.LocalPlayer
	    local char = plr.Character
	    local hum = char.Humanoid
	    hum.WalkSpeed = 0
        hum.JumpPower = 0
        wait(0.5)
        Parent.Part.Sparkles.Enabled = true
        wait(0.3)
        Parent.Handle.ParticleEmitter.Enabled = true
        wait(0.6)
        Parent.MeshPart1.Specks.Enabled = true
        wait(0.8)
        Parent.Part.Sparkles.Enabled = false
        wait(0.0000000000000000000000001)
        Parent.MeshPart1.Specks.Enabled = false
        wait(0.6)
        Parent.Handle.ParticleEmitter.Enabled = false
        wait(0.1)
        Parent.Parent.Tool:Destroy()
		wait(2)
		CanSwing = true
		hum.WalkSpeed = 16
        hum.JumpPower = 50
        Parent.LocalScript:Destroy()
	end
end)

1 answer

✓ Accepted answer

Your part has to be named "Handle" for the tool to work.

This discussion is preserved as it was. New answers, comments, and votes are closed.