#problem with gravity script
10 messages · Page 1 of 1 (latest)
but when a player touch it , the gravity change works for all players in the game. it mussn't do it
so what do u want it to do
just change it to Humanoid
so likelua hrp.Touched:Connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') then local Humanoid = hit.Parent local Gravity = {1, 145, 14, 146} -- change the numbers local PlayersGravity = workspace.Gravity local Part = 'Part' -- name it to the Name of Gravity local Part1 = 'Part1' -- define Part1 with the name of the first gravity-changing part local Part2 = 'Part2' -- define Part2 with the name of the second gravity-changing part local Part3 = 'Part3' -- define Part3 with the name of the third gravity-changing part if hit.Name == Part then PlayersGravity = Gravity[1] -- for example elseif hit.Name == Part1 then PlayersGravity = Gravity[2] elseif hit.Name == Part2 then PlayersGravity = Gravity[3] elseif hit.Name == Part3 then PlayersGravity = Gravity[4] else PlayersGravity = PlayersGravity end Humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, false) Humanoid.Gravity = Vector3.new(0, PlayersGravity, 0) Humanoid:SetStateEnabled(Enum.HumanoidStateType.Physics, true) end end)
all this in the local script inside startercharapterscripts or playerscripts?
to be honest u did the script so i made it different
i made a script , for walkspeed and it is easy to do , the difference between this script that is used for walkspeed is , when someone touch it only the player that have touched it will walk faster lua local part = script.Parent part.Touched:Connect(function(hit) local Humanoid = hit.Parent:FindFirstChild("Humanoid") if Humanoid then Humanoid.Walkspeed = 60 end end)