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

how do i trigger an npc to do an animation whe a player touches a brick?

I have no idea how to do this. I've tried true/false values to trigger the animation and other stuff that was recommended, but none of it worked.. Please help!

1 answer

well just do this:

local Players = game:GetService("Players")
local part = --the part to be touched
local AnimationID = 0000000-- the animation id

part.Touched:Connect(function(part)
	local humanoid = part.Parent:FindFirstChld("Humanoid");
	if(humanoid and not Players:GetPlayerFromCharacter(part.Parent)) then
		local animationTrack = humanoid:LoadAnimation(AnimationID);
		animationTrack:Play();
	end
end)

3 comments

0

but that's playing animation on the player that touched the brick he wants the NPC to play animation not the player that touched.

0

ohh lemme edit it a bit to accomondate for that

0

Ok I’m about to test it

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