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)

3 comments

0

Use a reguar script(server) and place the script under the part(or anywhere in workspace if you want).

0

Do I then need to use remote events?

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?