I’ve been trying to find a good script or something to fix my bugs in my game about the gravity inside the dropper, because it’s going too much fast when I fall down, and sometimes it changes the gravity to something it shouldn’t.
script.Parent.Transparency = 1
parent = script.Parent
function onTouch(hit)
--parent.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
local character = hit.Parent
local HumanoidRootPart = character.HumanoidRootPart
if not HumanoidRootPart:FindFirstChild("NoGrav") then
local totalMass= 0
for _, instance in pairs(character:GetDescendants()) do
if instance:IsA("BasePart") then
print(instance, ' ', instance:GetMass())
totalMass += instance:GetMass()
end
end
local VectorForce = Instance.new("VectorForce")
local ForceAttachment = Instance.new("Attachment")
VectorForce.Attachment0 = ForceAttachment
ForceAttachment.Parent = HumanoidRootPart
VectorForce.Name = "NoGrav"
VectorForce.Force = Vector3.new(0, (totalMass * workspace.Gravity) - .1,5,0)
VectorForce.Parent = HumanoidRootPart
character.Animate.fall.FallAnim.AnimationId = "rbxassetid://9994619922"
end
end
end
parent.Touched:connect(onTouch)
– And don’t just say put lower numbers please its not helping –
script.Parent.Transparency = 1
parent = script.Parent
function onTouch(hit)
--parent.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
workspace.Gravity /= --[[number]] 2
end
end
parent.Touched:connect(onTouch)
This is the main script for when the player touches to start line or whatever it is. Just add another part at the finish line which changes the gravity back to 192.6 again with the same script.
At the finish line, insert a new part with a different name. Change the part name variable to the new part you’ve added, and change workspace.Gravity/= number to 196.2 (workspace.Gravity = 196.2).
parent = workspace.EndOfAllDropper
function onTouch(hit)
--parent.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
workspace.Gravity = 196.2
end
if hit:LoadCharacter() then
workspace.Gravity = 196.2
end
end
parent.Touched:connect(onTouch)
part = workspace.EndOfAllDropper
function onTouch(hit)
--parent.Touched:connect(function(hit)
local humanoid = hit.Parent:FindFirstChild("Humanoid")
if humanoid then
workspace.Gravity = 196.2
hit.Parent:SetPrimaryPartCFrame(part.CFrame) -- spawnpoint
end
end
part.Touched:connect(onTouch)