Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would i make a script that makes humanoids walk slower in water terrain?

(I already have a script that disables swimming)

local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local hum = char:WaitForChild("Humanoid")
 
hum:SetStateEnabled(Enum.HumanoidStateType.Swimming, false)

1 answer

✓ Accepted answer

If You Want To Make Them Slower Use A Touched Function

Place A Script Inside Of The Part That Will Slow Them Down Then Another One Setting The WalkSpeed Back.

local slow = 10 -- Set To Wanted Speed
script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChildOfClass("Humanoid") then
		hit.Parent:FindFirstChildOfClass("Humanoid").WalkSpeed = slow
	elseif hit.Parent.Parent:FindFirstChildOfClass("Humanoid") then
		hit.Parent.Parent:FindFirstChildOfClass("Humanoid").WalkSpeed = slow
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.