Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years 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 25 — 5y
0
Do I then need to use remote events? AndriusTheGreat 140 — 5y
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 140 — 5y

Answer this question