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

How can you enable a script that plays an animation?

Asked by 2 years ago

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?

0
is your script enable from the start. also, is it meant to be used more then once? R_LabradorRetriever 198 — 2y
0
Well, my local script enables from a button press, and it doesnt enable from the start, vobidobo 2 — 2y
0
Are both a local script? ashk3000 32 — 2y
0
No, the animation script is a normal script, the disable script is a local script.! vobidobo 2 — 2y
View all comments (2 more)
0
LocalPlayer can only be used in Localscripts Avi_i 2 — 2y
0
oh thanks :D vobidobo 2 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago
Edited 2 years ago

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.

Ad

Answer this question