So I was making a flood escape 2 similar game and I was working on the flood, but when I was in first person, it kept freezing me. So here is some knowledge on what it does. When you first get into it, you get stuck in the air. (I am using BodyVelocity.) When you press LeftShift you go down but when you press Space you go up. It is the same mechanics as Flood Escape 2, but the zooming. Can you help me with it? Here’s the script:
local player = game.Players.LocalPlayer
local char = player.Character
local UserInputService = game:GetService("UserInputService")
local waterstop = false
local mouse = player:GetMouse()
local inwater = false
local water = false
local floodoff = false
local checkornot = false
local swimornot = false
repeat wait()
inwater = false
until inwater == false
local spam1 = false
local spam2 = false
game.Workspace.Water.Touched:Connect(function(hit)
if checkornot == false then
if hit.Parent:FindFirstChild("Head") then
if spam1 == false then
spam1 = true
end
script.SplashEffect:Play()
water = true
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local chr = plr.Character
if chr.Torso:FindFirstChild("Water") then
local BodyVelocity = chr.Torso:FindFirstChild("Water")
BodyVelocity.MaxForce = Vector3.new(0,99999999,0)
BodyVelocity.Velocity = Vector3.new(0,0,0)
spam1 = false
end
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Space then
if water == true then
if waterstop == false then
waterstop = true
swimornot = true
local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
if inwater == false then
wait(0.1)
inwater = true
local BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Parent = torso
BodyVelocity.Name = "Water"
BodyVelocity.MaxForce = Vector3.new(0,99999999,0)
BodyVelocity.Velocity = Vector3.new(0,14,0)
elseif inwater == true then
wait(0.1)
local BodyVelocity = torso:FindFirstChild("Water")
BodyVelocity.Velocity = Vector3.new(0,14,0)
end
end
end
end
end)
UserInputService.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.Space then
if waterstop == true then
if water == true then
waterstop = false
swimornot = false
local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
local BodyVelocity = torso:FindFirstChild("Water")
BodyVelocity.Velocity = Vector3.new(0,0,0)
end
end
end
end)
-- SHIFT
UserInputService.InputBegan:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
if water == true then
swimornot = true
local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
local BodyVelocity = torso:FindFirstChild("Water")
BodyVelocity.Velocity = Vector3.new(0,-14,0)
end
end
end)
UserInputService.InputEnded:Connect(function(key)
if key.KeyCode == Enum.KeyCode.LeftShift then
if water == true then
swimornot = false
local torso = char:FindFirstChild("Torso") or char:FindFirstChild("HumanoidRootPart")
local BodyVelocity = torso:FindFirstChild("Water")
BodyVelocity.Velocity = Vector3.new(0,0,0)
end
end
end)
end
end
end)
game.Workspace.Water.TouchEnded:Connect(function(hit)
local humhead = hit.Parent:FindFirstChild("Head")
local hum2 = hit.Parent:FindFirstChild("Torso")
local hum3 = hit.Parent:FindFirstChild("Left Leg")
local hum4 = hit.Parent:FindFirstChild("Left Arm")
local hum5 = hit.Parent:FindFirstChild("Right Leg")
local hum6 = hit.Parent:FindFirstChild("Right Arm")
local hum = hit.Parent:FindFirstChild("Humanoid")
if hum and hum2 and hum3 and hum4 and hum5 and hum6 and hum and humhead then
if spam2 == false then
spam2 = true
end
script.LeaveEffect:Play()
local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
local chr = plr.Character
chr.Humanoid.Jump = true
local torso = chr:FindFirstChild("Torso") or chr:FindFirstChild("HumanoidRootPart")
inwater = true
chr.Torso.Water.MaxForce = Vector3.new(0,0,0)
water = false
spam2 = false
end
end)
Sorry, I didn’t have much time making this.