RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"make a roblox script that will make you swim"
-- local script local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local swimAnimation = Instance.new("Animation") swimAnimation.AnimationId = "rbxassetid://YourSwimAnimationIDHere" local swimTrack = humanoid:LoadAnimation(swimAnimation) local function checkSwimming() while true do wait(0.5) local head = character:FindFirstChild("Head") if head then local headPosition = head.Position local waterParts = workspace:FindPartsInRegion3(headPosition, headPosition, {character}) local isSwimming = false for _, part in ipairs(waterParts) do if part.Name == "Water" then isSwimming = true break end end if isSwimming then if not swimTrack.IsPlaying then swimTrack:Play() end else if swimTrack.IsPlaying then swimTrack:Stop() end end end end end checkSwimming()