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

Is it possible to make a player do an animation when the player clicked the block?

Asked by 7 years ago
Edited 7 years ago
01local player = game.Players:GetPlayerFromCharacter(onClicked)
02local hum = player.Humanoid
03 
04local anim = hum:LoadAnimation(player.Animate.laugh.LaughAnim)
05 
06function onClicked()
07 
08 
09anim:Play()
10 
11    wait(2)
12 
13 
14script.Parent.ClickDetector.MaxActivationDistance = 0
15 
View all 22 lines...

2 answers

Log in to vote
0
Answered by 7 years ago
01script.Parent.ClickDetector.MouseClick:Connect(function (player)
02    local humanoid = player.Character.Humanoid
03    local anim = humanoid:LoadAnimation(player.Character.Animate.laugh.LaughAnim)
04    anim:Play()
05    cooldown()
06end)
07 
08function cooldown()
09    script.Parent.ClickDetector.MaxActivationDistance = 0
10    wait(60)
11    script.Parent.ClickDetector.MaxActivationDistance = 20
12end

Make this in a normal script.

Ad
Log in to vote
0
Answered by 7 years ago

This may not work but here we go...

01wait(10.5)
02local player = game.Players:GetPlayerFromCharacter(onClicked)
03local hum = player.Humanoid
04 
05local anim = hum:LoadAnimation(player.Animate.laugh.LaughAnim)
06 
07function onClicked()
08    anim:Play()
09     wait(2)
10end
11 
12script.Parent.ClickDetector.MouseClick:connect(onClicked)

I removed your waits and other useless things because it made it not work, did not test this yet...

0
It didn't work. The output says the following: "Request was throttled. Try sending fewer requests. Key = 45136777" Voideyz 4 — 7y
0
Workspace.Part.Script:3: attempt to index local 'player' (a nil value) Voideyz 4 — 7y

Answer this question