New: Nitro Boost our Discord server and receive full donation perks here on the website! Join the Scripting Helpers Discord Server to learn more! You can also Support on Patreon as always.
Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
0

Why does the animation not play when the player touches the part?

Asked by 11 days ago

Why does the animation not play when the player touches the part? The localscript is located in StarterGui.

local hum = game.Workspace.Dannebrog.HumanoidCharacter
local set = hum.Parent.Settings
local sp = set.Speed
local enabled = set.Enabled

if hum then
    print("Success")
else
    print("No HumanoidCharacter")
end

local humanim = hum:LoadAnimation(hum.Parent.Settings.IdleAnimation)

game.Workspace.TriggerPart.Touched:Connect(function(part)
    if part.Parent.Humanoid then
        humanim:Play()
        humanim.Looped = false
        humanim:AdjustSpeed(sp.Value)
    end
end)

0
Use a reguar script(server) and place the script under the part(or anywhere in workspace if you want). JudgeDuckie 5 — 11d
0
Do I then need to use remote events? AndriusTheGreat 106 — 11d
0
It looks like working, however, if i touch the block multiple times the animation start all over again, is there a way that i can add a debounce? AndriusTheGreat 106 — 11d

Answer this question