Im making a car, and I need to add the username of a player to a script in order for it to work. The car spawner script spawns the car in with the name "playersusername"sCar. So for example, when I spawn the car in, it would be named mcslimemansCar . I need to find out a way to insert a players username into this line of code.
local Car = workspace:FindFirstChild(--insert code here)
So what would i put inside of that slot? I want it to be playersusernamesCar but I can not figure out how to do it. I have tried adding
player.Name .. 'sCar'
into the slot, but it doesn't work. it says w001: Unknown global 'player'
The errors in the output are 13:00:47.339 - Workspace.mcslimemansCar.DriveScript:4: attempt to index nil with 'Name'
Any help would be appreciated
Turns out i didnt need to add their username. I did local car = script.Parent instead of local car = mcslimemansCar. So instead of trying to find it in the workspace, it just finds the parent of the script, which is the car.