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

How can you enable a script that plays an animation?

So, the problem is that im trying to enable a script, but it doesnt...

Script (LOCALSCRIPT):

script.Parent.MouseButton1Click:Connect(function()
	**game.Workspace["The castle dungeon"].GuardF.Script.Disabled = false**
	script.Parent.Parent.Parent.HackyMouseMovementStuff.TextButton:Destroy()
end)

Script that i want to enable:

local hum = script.Parent.Humanoid
local Animation = Instance.new("Animation")
local plyr = game:GetService('Players').LocalPlayer
Animation.AnimationId = "rbxassetid://9320074412"


	print("Signal Successful!")
	local AnimationTrack = script.Parent.Humanoid:LoadAnimation(Animation)
	AnimationTrack.Priority = Enum.AnimationPriority.Action
	AnimationTrack.Looped = false
	AnimationTrack:Play()
	wait(0.6)
	script.Parent:Destroy()

Can anyone please help?

6 comments

0

is your script enable from the start. also, is it meant to be used more then once?

0

Well, my local script enables from a button press, and it doesnt enable from the start,

0

Are both a local script?

0

No, the animation script is a normal script, the disable script is a local script.!

0

LocalPlayer can only be used in Localscripts

0

oh thanks :D

1 answer

✓ Accepted answer

you cannot use LocalPlayer in a normal script. it looks like you are not even using your plyr variable so you can delete it.

If that does not work it is because you cant enable a script from a local script. Try using a Remote Event.

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