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

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

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

✓ Accepted answer
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.

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...

2 comments

0

It didn't work. The output says the following: "Request was throttled. Try sending fewer requests. Key = 45136777"

0

Workspace.Part.Script:3: attempt to index local 'player' (a nil value)

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