I need help with this

The animation I want to play when the drag detector starts wont play for some reason and it says Play is not a valid member of animation.


dragdetector.DragStart:Connect(function(plr)
	local hum = plr.Character:FindFirstChild("Humanoid")
	local anim = Instance.new("Animation")
	anim.AnimationId = "rbxassetid://17472466016"
	local animtrack = hum:LoadAnimation(anim)
	anim:Play()
	
	
	workspace.Game.Edgetop.BrickColor = BrickColor.new(Color3.fromRGB(86, 255, 24))
	workspace.Game["Edge bottom"].BrickColor = BrickColor.new(Color3.fromRGB(86, 255, 24))
	workspace.Game["Edge right"].BrickColor = BrickColor.new(Color3.fromRGB(86, 255, 24))
	workspace.Game["Edge left"].BrickColor = BrickColor.new(Color3.fromRGB(86, 255, 24))
	
end)

dragdetector.DragEnd:Connect(function(plr)
	workspace.Game.Edgetop.BrickColor = BrickColor.new(Color3.fromRGB(110, 153, 202))
	workspace.Game["Edge bottom"].BrickColor = BrickColor.new(Color3.fromRGB(110, 153, 202))
	workspace.Game["Edge right"].BrickColor = BrickColor.new(Color3.fromRGB(110, 153, 202))
	workspace.Game["Edge left"].BrickColor = BrickColor.new(Color3.fromRGB(110, 153, 202))
end) ```

The fix is very simple! All you have to do is change anim:Play() to animtrack:Play().

Anim is an Instance, so you cannot use :Play(), while animtrack is the actual Animation.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.