Hi!, So I made a car spawner script for a specefic user id only (I'm just starting to learn scripting)
So the problem is it doesn't work and I don't get anny errors, here's the script :
--Settings. local inUse = false local allowed = {69198594} local players = game:GetService("Players") script.Parent.Button.ClickDetector.MouseClick:connect(function(player) if inUse == false and not game.Workspace:FindFirstChild("car"..player.Name.."1") then if allowed[i] == player.UserId then inUse = true script.Parent.Button.BrickColor = BrickColor.new("Really black") local a = game.ServerStorage:FindFirstChild(script.Parent.CarName.Value) if a ~= nil then local b = a:Clone() b.Parent = game.Workspace b.Name = "car"..player.Name.."1" end wait(1) script.Parent.Button.BrickColor = BrickColor.new("Navy blue") inUse = false end end end)
Thanks of you could help me :D
You're missing a loop in the code to loop through all of the allowed players.
It should be in between
if inUse == false and not game.Workspace:FindFirstChild("car"..player.Name.."1") then
and
if allowed[i] == player.UserId then
Because i
in this case is nothing