-- le regular script inside StarterCharacterScripts while true do if trainSpawn.Enabled == true and humroot.Position.Y < 8 and hum.Health > 0 then -- if the train is active, the player is below the general stand height of the train, and the player isn't dead humroot.Velocity = Vector3.new(0, 0, -500) -- set the player's velocity to match the train's velocity humroot.CFrame = CFrame.new(trainSpawn.CFrame.X, trainSpawn.CFrame.Y + 1.35, trainSpawn.CFrame.Z) -- set the CFrame of the HumanoidRoot part to the CFrame of the invisible spawn on the train + 1.35 Y end wait() end -- be4 da loop local player = script.Parent local playerObject = game:GetService("Players"):WaitForChild(tostring(script.Parent.Name)) local humroot = player:WaitForChild("HumanoidRootPart") local hum = player:WaitForChild("Humanoid") local trainSpawn = game:GetService("Workspace").Train.TrainSpawn
So I haz this game
where well
self-explanatory; u hop on a train and fly to the glitchlands
The script above is meant to save the player if they fall.
However, it eventually comes to constantly teleporting the player directly behind the train over and over again.
I want to make it so that if the if
statement is triggered multiple times (e.g. 5 times) in a short period of time (e.g. 3 seconds), such is detected, and the CFrame.Z
changes slowly each over-trigger (e.g. minus 10 per each over-teleport), and then after the player is correctly placed on the train the CFrame.Z
in the script resets back.
So ye, what prescription do
you suggest?