So I'm trying to recreate drowning from a pirates life in my game
Recreated drowning in my game
Script that checks y Pos
local player = script.Parent.Parent
repeat wait() until player.Character
wait()
repeat wait() until player.Character:findFirstChild("Torso")
local torso = player.Character.Torso
while true do
repeat wait() until torso.Position.y < 172 and player.Character:findFirstChild("Animate") and not torso:findFirstChild("Drowning")
local sc = script.Drowning:clone()
sc.Disabled = false
sc.A.Script.Disabled = false
sc.Parent = torso
wait()
end
Script that gets cloned
local ls = script.Parent:findFirstChild("Left Shoulder")
local rs = script.Parent:findFirstChild("Right Shoulder")
local anim = script.Parent.Parent:findFirstChild("Animate")
if anim ~= nil then anim.Parent = script end
local val = false
local bp = script.BodyPosition
bp.Parent = script.Parent
while true do
wait()
if script.Parent.Position.y > 173 then
bp.Parent = nil
if anim ~= nil then anim.Parent = script.Parent.Parent end
script:remove()
else
val = not val
-- if val then
script.Parent.Parent.Humanoid.Health = script.Parent.Parent.Humanoid.Health - 0
-- end
if ls ~= nil then ls.DesiredAngle = script.A.Value end
if rs ~= nil then rs.DesiredAngle = script.A.Value * -1 end
end
end
script inside A Value
script.Parent.Value = math.pi - 0.5
while true do
wait()
for i = 1, 10 do
script.Parent.Value = script.Parent.Value + 0.1
wait()
end
for i = 1, 10 do
script.Parent.Value = script.Parent.Value - 0.1
if i ~= 10 then
wait()
end
end
end
basically what I'm trying to accomplish making getting on land easier when drowning because right now the character gets stuck in a climbing position and when he tries to jump it shoots him back into the water not allowing him to get out of the water unless he times it right
the scripts are in the starterpack

1 comment
I also thought of making a recreate of A Pirate's Life. Would you like to team with me? Btw he used BodyPositions.