You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Create a brick that stops playing an animation
What is the issue? I used this script below to play an animation when a player touches a brick. Assuming that it would work if I replaced :Play() with :Stop(), it would stop the animation. But it didn’t.
function onTouched(hit)
local human = hit.Parent:findFirstChild("Humanoid")
if human then
local anim = human:LoadAnimation(script.Parent.Animation)
anim:Play()
end
end
script.Parent.Touched:connect(onTouched)
What solutions have you tried so far? I tried looking on the Dev Forum or watching videos but couldn’t find anything
function onTouched(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local anim = animator:LoadAnimation(script.Parent:WaitForChild("Animation"))
anim:Play()
end
end
script.Parent.Touched:connect(onTouched)
function onTouched(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local humanoid = hit.Parent:FindFirstChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local anim = animator:LoadAnimation(script.Parent:WaitForChild("Animation"))
anim:Stop()
end
end
script.Parent.Touched:connect(onTouched)
Have 2 parts, one which starts the animation & another which stops the animation. Place each script in each part.