I made a script for swimming and its saying "LoadAnimation is not a valid member of Part" when ever I touch the Part named Water this is the script:
function Swimming(player,Humanoid)
local animation=Instance.new("Animation")
animation.AnimationId="http://www.roblox.com/Asset?ID=1010301459"
local animTrack=player:LoadAnimation(animation)
animTrack:Play()
print "going to swim this player on:"
local debounce=false
if debounce==false then
debounce = true
print(player.Model.Name)
script.Parent=workspace.Water
end
end
script.Parent.Touched:Connect(Swimming)
this is the first animation script I made, what I want it to do is play my animation when ever I touch the scripts parent but the error I get in the output is "LoadAnimation is not a valid member of Part" please help me fix this.thx

3 comments
you need to index the parent of the newly created animation on line 2.
what do you mean by index?
The Touched event passes the base part that touched not the player and humanoid.