Car spawn in front of player doesn't work Why? i try and doens´t work [solved]
i'm trying to make a car maker in front of the player but this error appears when i click the button
Model:SetPrimaryCFrame() failed because no PrimaryPart has been set, or the PrimaryPart no longer exists. Please set Model.PrimaryPart before using this.
- Stack Begin
- Script 'ServerScriptService.SpawnCar', Line 6
- Stack End
this is the script
1 | game.ReplicatedStorage.CarEvents.SpawnCar.OnServerEvent:Connect( function (player, vehicle) |
2 | local clonedvehicle = game.ReplicatedStorage.Vehicles [ vehicle ] :Clone() |
3 | clonedvehicle.Parent = workspace |
4 | clonedvehicle.Name = player.Name.. "'s Car" |
6 | clonedvehicle:SetPrimaryPartCFrame(game.Workspace [ player.Name ] .Head.CFrame) |
7 | clonedvehicle:MakeJoints() |