Hello, I am trying to make drowning system and here is some problem
IsTouching is not a valid member of Part “Workspace.MoonScro.HumanoidRootPart”
Can I have any solution?
local function TouchingWater()
local player = game.Players.LocalPlayer
local character = player.Character
if character then
local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
if humanoidRootPart then
local waterPart = game.Workspace:FindFirstChild("Water")
if waterPart then
if humanoidRootPart:IsTouching(waterPart) then
print(player.Name .. " is touching water!")
end
end
end
end
end
while true do
wait(0.1)
TouchingWater()
end