I'm trying to make it so when you touch a certain part you'll start swimming, but when you stop you'll go back to normal. I put the script in the workspace since it's in a local script.
function onTouch(hit)
game.StarterGui.Water.Water.Visible = true
local humanoid = part.Parent:findFirstChild("Humanoid")
while wait() do
if (humanoid ~=nil) then
Humanoid.ChangeState(Enum.HumanoidStateType.Swimming)
end
end
end
workspace.Water1Test.Touched:Connect(onTouch)

3 comments
add the animation and play it
ChangeState() is a method not an object
it should be Humanoid:ChangeState()