Hello everyone, I’m developing a zombie game.
I decided to make a custom swimming script using magnitude, but when I tested, it didn’t work. I think it might not work on big sized parts.
demonstration:
script server:
game:GetService(“RunService”).Heartbeat:Connect(function()
if game.Workspace:FindFirstChild(“Map”) then
for i,v in pairs(game.Workspace.Map.Waters:GetChildren()) do
if v.ClassName == “Part” or v.ClassName == “MeshPart” then
if (v.Position-script.parent.HumanoidRootPart.Position).Magnitude <= 5 then
script.parent.IsSwimming.Value = true
else
script.parent.IsSwimming.Value = false
end
end
end
else
script.parent.IsSwimming.Value = false
end
end)
idk how to fix it… please help me