I have a problem in a game that I have made and the teleport is not working . I have no idea why but it is getting really annoying now. The model’s position spawns where it is stored in replicated storage. Here is the script
game.ReplicatedStorage.CarStore.OnServerEvent:Connect(function(Player)
local garageButton = Player.PlayerGui.CameraGui.TextButton
local gui = Player.PlayerGui.CameraGui
garageButton.Visible = false
cameraFire()
Player.PlayerGui.MenuGui.Enabled = false
Player.PlayerGui.MenuGui.Frame.Visible = false
gui.StopButton.Visible = true
Player.Team = game.Teams.Workshop
print(Player.Name.." Transferred to Garage")
Player:FindFirstChild("InWorkshop").Value = true
Player.Character.Parent = game.Workspace.WorkshopCheck
Player.Character.HumanoidRootPart.CFrame = game.Workspace.WorkshopCheck.CFrame
gui.LeftButton.Visible = true
gui.RightButton.Visible = true
gui.KartName.Visible = true
if Player.Karts:FindFirstChild("KartEquipped").Value ~= nil then
for i, v in pairs(game.ReplicatedStorage.Karts:GetChildren()) do
if v.KartNum.Value == Player.Karts.KartEquipped.Value then
print("It worked")
local kartclone = v:Clone()
kartclone.Name = Player.Name.."'s Demo"
kartclone.Parent = game.Workspace
gui.KartName.Text = kartclone.Name
local playerNumber = Player.PlayerSet.Value
if playerNumber == 1 then
wait(0.1)
print("player number is 1")
local spawn1 = CFrame.new(-9861.484, 93.602, 1377.433) * CFrame.Angles(0, math.rad(91.027), 0)
if game.Workspace:WaitForChild(Player.Name.."'s Demo") then
wait(2)
game.Workspace:WaitForChild(Player.Name.."'s Demo"):GetPrimaryPartCFrame(CFrame.new(-9859.582, 231.139, 1355.449)) -- The teleport part that isn't working
end
end
end
end
end
end)
Any help will be highly appreciated