The maximum number of players in a server is 4 and I want a table that has a gun for each player so that they cannot take more than needed, but if there are less than 4 players in the game then I want it to only show that number of guns on the table
This is what I have gotten so far
local Players = game:GetService("Players") local players = Players:GetPlayers() local replicatedstorage = game.ReplicatedStorage local clonegun = replicatedstorage.Gun:Clone() local clonegun2 = replicatedstorage.Gun2:Clone() local clonegun3 = replicatedstorage.Gun3:Clone() local clonegun4 = replicatedstorage.Gun4:Clone() if #players == 1 then clonegun.Parent = game.Workspace end
everytime I join the game there appears to be no guns anywhere in the workspace
Assuming all 4 guns are the same, you could make a for loop that goes through all the players..
wait(3) local Players = game:GetService("Players") local players = Players:GetPlayers() local replicatedstorage = game.ReplicatedStorage for i,v in pairs(players) do local clonegun = replicatedstorage.Gun:Clone() clonegun.Parent = game.Workspace clonegun.Position = Vector3.new() -- inside your brackets write the position you want to send your gun to e.g. (1,1,1) end