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

0

add the animation and play it

0

ChangeState() is a method not an object

0

it should be Humanoid:ChangeState()