I wanna make this local script to return the normal gravity (196.2)
If I touch part the named (EndOfAllDropper) or till I die/reset
Its local script inside StarterCharacterScripts
parent = workspace.NormalLobby.TryTheObbyTeleport.ChangingAnimationAndStart.Part
function onTouch(hit)
--parent.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
workspace.Gravity /= 2
end
end
parent.Touched:connect(onTouch)
local parent = workspace.NormalLobby.TryTheObbyTeleport.ChangingAnimationAndStart.Part
local OldGravity = workspace.Gravity
function onTouch(hit)
local Hum = hit.Parent:FindFirstChild("Humanoid")
if Hum and hit.Parent.Name == game.Players.LocalPlayer.Name then
workspace.Gravity /= 2
Hum.Died:Connect(function()
workspace.Gravity = OldGravity
end)
end
end
parent.Touched:connect(onTouch)
It is in StarterCharacterScripts, meaning the script will reset once the player respawns.
Add an IntValue in ReplicatedStorage to store the default value of gravity.
local parent = workspace.NormalLobby.TryTheObbyTeleport.ChangingAnimationAndStart.Part
workspace.Gravity = game.ReplicatedStorage.Gravity.Value
function onTouch(hit)
local Hum = hit.Parent:FindFirstChild("Humanoid")
if Hum and hit.Parent.Name == game.Players.LocalPlayer.Name then
workspace.Gravity /= 2
end
end
parent.Touched:connect(onTouch)