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

Help fix this script to only occur when the tool is equipped? [closed]

Asked by 7 years ago

player = game.Players.LocalPlayer

mouse = player:GetMouse()

animation = script:WaitForChild("Animation")

enabled = true

mouse.Button1Down:connect(function() if enabled then enabled = false

    local animationTrack = player.Character.Humanoid:LoadAnimation(animation)
    animationTrack:Play()

    wait(3)
    enabled = true

    animation:Stop()

end

end)

0
Idk why the script seperated. Sorry. wolfbarrier123 -25 — 7y
0
Use .Equipped TheLuckyZ 24 — 7y
0
Where should I write that? wolfbarrier123 -25 — 7y

Closed as Not Constructive by RubenKan and TheeDeathCaster

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 7 years ago

You put enabled to true at the start.

To make this script occur only when the tool is equipped, try this :

equipped = false

script.Parent.Equipped:connect(function()
    equipped = true
end

This is what i do with my scripts and it works.

0
for the script.parent part..do I put the name of the script or the name of the tool it is in? loulou112 wolfbarrier123 -25 — 7y
0
Where do I paste in my script? It doesn't work when I paste it in the beginning. loulou112 wolfbarrier123 -25 — 7y
Ad