So this script works when I test on the client, but not in a server. I know it's because I'm trying to reference the player, but I'm not sure how I should be doing it from a server script.
function teleport()
local target
for i, player in ipairs(game.Players:GetChildren()) do
if player.Playing.Value == 0 then
local char = player.Character or player.CharacterAdded:Wait()
if char.Humanoid.Health ~= 0 and char:FindFirstChild("Choice") then -- "Choice" from vehicle select gui local script
print("Choice")
-- ADD CARS HERE. Probably a more efficient way to do this
if char.Choice.Value == "Car1" then
local Car1 = game.ServerStorage.Car1:Clone()
Car1.Parent = game.Workspace
target = Car1.PrimaryPart.CFrame
char.HumanoidRootPart.CFrame = target
player.Playing.Value = 1
end
else if char.Choice.Value == "Car2" then
-- etc
end
end
end
end
end

8 comments
I did 1) in line 3. Must be a different problem?
Problem is in line 2, local target = -- then nothing, why? or just a bad copy?
I defined that in line 15
Not 15, 12
Never mind. It was an issue with firing the function that stemmed from a different script. Thanks for your help
Np :)
Still trying to wrap my head around filtering enabled lol. I keep forgetting about it
Well, if you have any questions about it, just ask me lol