I want to make a part which you can swim through, however I’m running into some issues.
This is my code:
local ocean = game.Workspace.ocean
local oceanTouchDebounce = false
for _, v in next, ocean:getChildren() do
v.Touched:Connect(function(hit)
local model = hit:FindFirstAncestorOfClass("Model")
if model and oceanTouchDebounce == false then
oceanTouchDebounce = true
if model:FindFirstChild("Humanoid") then
model.Humanoid:SetStateEnabled('Running',false)
model.Humanoid:SetStateEnabled('RunningNoPhysics',false)
model.Humanoid:SetStateEnabled('Climbing',false)
model.Humanoid:SetStateEnabled('Jumping',false)
model.Humanoid:SetStateEnabled("GettingUp", false)
model.Humanoid:ChangeState("Swimming")
print("touched")
end
end
task.wait(.1)
oceanTouchDebounce = false
end)
end
So basically there is a folder in my game with 80 parts that are gigantic planes, x z = 2048 and the y is 80, and when I try to swim in that artificial ocean the method I use which I got from another forum does not work. It does print “touched” but the character is not swimming.