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

3 comments
Like : for i = 1, #allowed do ?
or can I also just remove the [i] ?
A for loop like you said will do just fine