What do you want to achieve? Make my character not fling high in the air when holding space
What is the issue? Video:
What solutions have you tried so far? I didn’t try anything to fix this and it’s been in the game for 8 months
What do you want to achieve? Make my character not fling high in the air when holding space
What is the issue? Video:
What solutions have you tried so far? I didn’t try anything to fix this and it’s been in the game for 8 months
Can you send the code?
Your question is very vague
Sorry that it took so long I was sleeping
Code:
local Character = script.Parent.Parent
local LastCF = Character.HumanoidRootPart.CFrame
local camera = workspace.CurrentCamera
local LastCamCF = camera.CFrame
local RS = game:GetService("RunService")
local o2debounce = false
--Player Physics
function Changed(NewCF)
if Character.HumanoidRootPart.Position.Y < 59 then
game.Lighting.FogColor = Color3.fromRGB(251, 255, 202)
Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.GettingUp, false)
Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, false)
Character:WaitForChild("Humanoid"):ChangeState(Enum.HumanoidStateType.Swimming)
local player = game.Players:GetPlayerFromCharacter(Character)
player:WaitForChild("PlayerGui"):WaitForChild("WaterGui").Enabled = true
player:WaitForChild("PlayerGui"):WaitForChild("WaterGui"):WaitForChild("Frame"):WaitForChild("Depth").Text = "Depth: " .. math.abs(math.floor(Character.HumanoidRootPart.CFrame.Y <= 59 and (Vector3.new(0,59,0) - Vector3.new(0,Character.HumanoidRootPart.Position.Y,0)).magnitude or 0))
workspace.Gravity = 5
if o2debounce == false then
o2debounce = true
spawn(function()
while Character.HumanoidRootPart.Position.Y < 59 do
wait(0.3)
if player:WaitForChild("PlayerGui"):WaitForChild("WaterGui"):WaitForChild("Frame"):WaitForChild("O2Bar"):WaitForChild("Green").Position.X.Scale > -1 then
player:WaitForChild("PlayerGui"):WaitForChild("WaterGui"):WaitForChild("Frame"):WaitForChild("O2Bar"):WaitForChild("Green").Position -= UDim2.new(0.01,0,0,0)
else
Character:WaitForChild("Humanoid").Health = 0
o2debounce = false
end
end
end)
end
else
game.Lighting.FogColor = Color3.fromRGB(11, 170, 255)
o2debounce = false
Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.GettingUp, true)
Character:WaitForChild("Humanoid"):SetStateEnabled(Enum.HumanoidStateType.Jumping, true)
local player = game.Players:GetPlayerFromCharacter(Character)
player:WaitForChild("PlayerGui"):WaitForChild("WaterGui"):WaitForChild("Frame"):WaitForChild("O2Bar"):WaitForChild("Green").Position = UDim2.new(0,0,0,0 )
local player = game.Players:GetPlayerFromCharacter(Character)
player:WaitForChild("PlayerGui"):WaitForChild("WaterGui").Enabled = false
if not Character:FindFirstChild("MultiCoil") and not Character:FindFirstChild("GravityCoil") then
workspace.Gravity = 196.2
elseif Character:FindFirstChild("MultiCoil") or Character:FindFirstChild("GravityCoil") then
workspace.Gravity = 60
end
end
end
RS.Stepped:Connect(function(dt)
local NewCF = Character:WaitForChild("HumanoidRootPart").CFrame
if NewCF ~= LastCF then
LastCF = NewCF
Changed(NewCF)
end
end)
--\\
--Camera
function Changed2(NewCF2)
if camera.CFrame.Y < 59 then
game.Players.LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("ClientSounds"):WaitForChild("Sounds"):WaitForChild("UnderwaterAmbience").Playing = true
workspace.Ocean.Water.Transparency = 0.4
if game.Lighting.Underwater:FindFirstChild("UnderwaterBlur") then
game.Lighting.Underwater:WaitForChild("UnderwaterBlur").Parent = game.Lighting
end
if game.Lighting.Underwater:FindFirstChild("UnderwaterColor") then
game.Lighting.Underwater:WaitForChild("UnderwaterColor").Parent = game.Lighting
end
else
game.Players.LocalPlayer:WaitForChild("PlayerScripts"):WaitForChild("ClientSounds"):WaitForChild("Sounds"):WaitForChild("UnderwaterAmbience"):Stop()
workspace.Ocean.Water.Transparency = 0
if game.Lighting:FindFirstChild("UnderwaterBlur") then
game.Lighting:WaitForChild("UnderwaterBlur").Parent = game.Lighting.Underwater
end
if game.Lighting:FindFirstChild("UnderwaterColor") then
game.Lighting:WaitForChild("UnderwaterColor").Parent = game.Lighting.Underwater
end
end
end
RS.Stepped:Connect(function(dt)
local NewCF2 = camera.CFrame
if NewCF2 ~= LastCamCF then
LastCamCF = NewCF2
Changed2(NewCF2)
end
end)
--\\