Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

game.Workspace.spawner:8: attempt to local "c" (a nil value)? (works in studio, but not ingame)

I know i answered this question before, but no one answered it (only one, but it didnt work) title explains everything. in studio, it works and i get no errors, but ingame i getgame.Workspace.spawner:8: attempt to local "c" (a nil value).

script:

game.ReplicatedStorage:WaitForChild("SpawnCar").OnServerEvent:Connect(function(player,c)
	for i,v in pairs(game.Workspace:GetChildren()) do
		if v.Name == player.Name.."'s Car" then
			v:Destroy()
		end
	end
	wait(0.1)
	local car = c:Clone()
	car:SetPrimaryPartCFrame(player.Character.HumanoidRootPart.CFrame + Vector3.new(0,0,15))
	car.Parent = game.Workspace
	car:MakeJoints()
	car.Name = player.Name.."'s Car"
end)

script that fires it:

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.SpawnCar:FireServer(game.Players.LocalPlayer:WaitForChild("SelectedCar").Value)
end)

thanks

2 comments

0

Question, what is "C" on your script anyways?

0

If you look in the view source part of the code you will be able to see everything that it contains

1 answer

You're not parsing anything into the RemoteEvent. Make sure that when you run :FireServer() that you have an actual value inside the parantheses, and that you're not parsing a nil value.

Please upvote if this helped, and mark as the correct answer if it answered your question

2 comments

0

there actually is something inside it.

0

Add to your question: The script that triggers the RemoteEvent, and a screenshot of your explorer window

This discussion is preserved as it was. New answers, comments, and votes are closed.