So i’m trying to make a script, that if a humanoid touches a specific part, it plays a animation.
Now i’m not sure on how to do so.
Do i need to make a Script inside the brick, which registers the hit and acces the player? Or a Localscript in PlayerScript to register the hit, and if so. Does it then only play localy?
If you’d want everyone (Or the server) to see the animation, you’d do it on a
Server Script but if you want just only you to see it (Client wise), yeah just use a
It depends on what preference you’re mainly looking for
In this case Server-wide.
if Deb == true then return end
Deb = true
if Hit.Parent:FindFirstChild('Humanoid') then
Deb = false
You almost had it! All you need to do is find the Humanoid’s
Animator, then play the animation that way:
local Part = --Define your Part here plz
local Deb = false
local AnimationToPlay = --Somewhere, just define this to what animation you want to play
if Deb == true then
Deb = true
if Hit.Parent:FindFirstChild("Humanoid") then
local Animator = Humanoid:WaitForChild("Animator")
local PlayAnimation = Animator:LoadAnimation(AnimationToPlay)
Oh yeah another reminder as well, but
LocalScripts can only fire if they’re a part of a descendant of a client service
Examples can be:
The Character Model
Ah, you’re placing the Script inside PlayerScript?
Is it possible to not place it here. As the Parent of the Part changes every round, due different maps.
Ah yeah, since
LocalScripts can only work from the client & not the server side
It depends on where you put the part as well, so you’d need to keep in mind that