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 6 years ago
Edited 6 years ago
local player = game.Players:GetPlayerFromCharacter(onClicked)
local hum = player.Humanoid

local anim = hum:LoadAnimation(player.Animate.laugh.LaughAnim)

function onClicked()


anim:Play()

    wait(2)


script.Parent.ClickDetector.MaxActivationDistance = 0

wait(60)

script.Parent.ClickDetector.MaxActivationDistance = 20

end

script.Parent.ClickDetector.MouseClick:connect(onClicked)



2 answers

Log in to vote
0
Answered by 6 years ago
script.Parent.ClickDetector.MouseClick:Connect(function (player)
    local humanoid = player.Character.Humanoid
    local anim = humanoid:LoadAnimation(player.Character.Animate.laugh.LaughAnim)
    anim:Play()
    cooldown()
end)

function cooldown()
    script.Parent.ClickDetector.MaxActivationDistance = 0
    wait(60)
    script.Parent.ClickDetector.MaxActivationDistance = 20
end

Make this in a normal script.

Ad
Log in to vote
0
Answered by 6 years ago

This may not work but here we go...

wait(10.5)
local player = game.Players:GetPlayerFromCharacter(onClicked)
local hum = player.Humanoid

local anim = hum:LoadAnimation(player.Animate.laugh.LaughAnim)

function onClicked()
    anim:Play()
     wait(2)
end

script.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 — 6y
0
Workspace.Part.Script:3: attempt to index local 'player' (a nil value) Voideyz 4 — 6y

Answer this question