I am very very new to coding, I tried to modify a spawning car button. I'm attempting to make it so that when you step on the block it creates a car and if you already have a car as your child, then it is removed and instead spawns a new car as your child. In other words it just respawns the car. Testing with Play Mode. This is a server-side script
script.Parent.Touched:connect(function(GetCar)
local character = GetCar.Parent
local humanoid = character:FindFirstChildWhichIsA("Humanoid")
if humanoid then
local Mod = game.ServerStorage.car
local clone = Mod:clone()
clone.Parent = workspace
clone:MakeJoints()
elseif humanoid.child == game.ServerStorage.car
then
humanoid.child:remove
and
while true do humanoid then
local Mod = game.ServerStorage.car
local clone = Mod:clone()
clone.Parent = workspace
clone:MakeJoints()
end
end
end
end)
The error I get is this: Workspace.Part.script:13: Expected '(', '{' or , got 'and'

4 comments
Thank you!
No problem! It would be great if you could mark my response as the answer!
WizardEpidemic, click "Accept Answer" below ItzFoxz's answer.
Oh, thank you I didn't know