Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Some reason my script that makes the player stay on a lerping object wont work can someone help?

Asked by 5 years ago
Edited 4 years ago

So i put a script in serverscriptservice and put this in there

 local Players = game:GetService("Players")

local LastTrainCF

local function onCharacterAdded(player)

while true do

wait(0.1)



local RootPart = player.HumanoidRootPart

local Ignore = player

local ray = Ray.new(RootPart.CFrame.p, ((RootPart.CFrame.p-Vector3.new(0, 50, 0)) - RootPart.CFrame.p).Unit * 50)

local Hit, Position = workspace:FindPartOnRay(ray,Ignore)

if Hit.Name == "plat" then

print("Worked")



local Train = Hit

local TrainCF = Train.CFrame

LastTrainCF = Hit.CFrame

local Rel = TrainCF * LastTrainCF:Inverse()

RootPart.CFrame = Rel * RootPart.CFrame



end

end

end



local function onPlayerAdded(player)

player.CharacterAdded:Connect(onCharacterAdded)

end





Players.PlayerAdded:Connect(onPlayerAdded)

but this wont work can someone help?

0
#1. list any output errors theking48989987 2147 — 5y
0
#2, please put your code in a code block theking48989987 2147 — 5y
0
there are no errors Instance_Brick 12 — 5y
0
it just wont work Instance_Brick 12 — 5y
0
Fixed it no need to help me anymore Instance_Brick 12 — 5y

Answer this question