How to create terrain water behavior, without terrain water

why not just put water below a part and make it non collidable
wont work with transparent parts tho

Hey I tried to remake your script but instead, we try to find the “Sea” part in the workspace and can be located thanks to an attribute boolean called “YES”. But it doesnt seem to work, do you any idea?

local Sea
for _, child in pairs(workspace:GetChildren()) do
    if child.Name == "Sea" and child:FindFirstChild("YES") then
        Sea = child
        break
    end
end

local RS = game:GetService("RunService")
local Character = script.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Root = Character:WaitForChild("HumanoidRootPart")
local Swim

Humanoid:GetPropertyChangedSignal("MoveDirection"):Connect(function()
    if Sea and Root.Position.Y < Sea.Position.Y then
        if not Swim then
            Swim = Instance.new("BodyVelocity")
            Swim.Parent = Root
        end
        Swim.Velocity = Humanoid.MoveDirection * Humanoid.WalkSpeed
        if Humanoid:GetState() ~= Enum.HumanoidStateType.Swimming then
            Humanoid:ChangeState(Enum.HumanoidStateType.Swimming)
        end
    elseif Swim then
        Swim:Destroy()
    end
end)

Well, it looks like you are looking for the child called “YES” under the Sea part, which I think does not exist as you mentioned it as an attribute, not an object. You can use Instance:GetAttribute method to achieve precisely what you want. Still, I would suggest having an ObjectValue object in a set directory pointing to the sea part to avoid looking for it using a loop for every player.

P.S. Sorry for the late reply!

1 Like