Hello everyone this is my first question. I am making a diving game and am wanting to make a Life Vest. I want it to force the player to the top of the water and I have no idea how to do this. Any help?
COMMUNITY QUESTION
How do you make a Life Vest-type-tool?
1 answer
Solved this by myself. Here is my code in a Local Script. -
local p= game.Players.LocalPlayer
local tool= script.Parent
local State
local Info = true
local StateHelp = true
function equipped()
Info = true
StateHelp = true
while Info == true do
wait()
State = p.Character.Humanoid:GetState()
if State == Enum.HumanoidStateType.Swimming then
if StateHelp == true then
script.Parent.BodyPosition.Parent = script.Parent.Handle
end
StateHelp = false
end
end
end
function unequipped()
wait()
Info = false
if StateHelp == false then
script.Parent.Handle.BodyPosition.Parent = script.Parent
end
end
tool.Equipped:connect(equipped)
tool.Unequipped:connect(unequipped)
This discussion is preserved as it was. New answers, comments, and votes are closed.
