The script I made, meant to mimic gravity getting more intense as you fall, but it keeps running when landed. Where’d I go / do wrong?
local plr = script.Parent
local hum = script.Parent:WaitForChild(“Humanoid”)
local times = 0
function freefall()
repeat workspace.Gravity = workspace.Gravity +0.981
times = times + 0.981
until times == 196.2
end
hum.StateChanged:Connect(function(ENUM)
if ENUM == Enum.HumanoidStateType.Freefall then
freefall()
elseif ENUM == Enum.HumanoidStateType.Landed then
workspace.Gravity = 196.2
local plr = script.Parent
local hum = script.Parent:WaitForChild(“Humanoid”)
local times = 0
function freefall()
repeat workspace.Gravity = workspace.Gravity +0.981
times = times + 0.981
until times == 196.2
end
hum.StateChanged:Connect(function(ENUM)
if ENUM == Enum.HumanoidStateType.Freefall then
freefall()
elseif ENUM == Enum.HumanoidStateType.Landed then
workspace.Gravity = 196.2
end
end)
I didnt change anything,i just made it code,not text.
game.Workspace.ChildAdded:connect(function(Character)
if Character.Name == game.Workspace:FindFirstChild("Character.Name") then
Character = Character
end
end)
--Player Variable
local Hum = Character:FindFirstChild("Humanoid")
local times = 0
Hum.StateChanged:connect(function(Freefall)
repeat workspace.Gravity = game.Worksapce.Gravity +0.981
times = times + 0.981
until times == 196.2
end)--Freefall
Hum.StateChanged:Connect(function(ENUM)
if ENUM == Enum.HumanoidStateType.Freefall then
Freefall()
elseif ENUM == Enum.HumanoidStateType.Landed then
game.Workspace.Gravity = 196.2
end--Enum,if statement
end)--Enum
Maybe this code will work…correct me if i’am wrong,also thanks for waiting.]
Also,i think you should put this script in Workspace or ServerScriptService.Hope this helps!