How can I make a script that gives the people on certain teams a certain weapon, like for example the red team would get a redish gun, the blue team would get a bluish gun, etc.
The script would also very much be appreciated.
A script is not needed, all you have to do is to put the different weapons directly inside a team instead of the starterpack. This question has already been answered here, if you need more info.
Ok first of all, never request a script, that's a rule of the website. By the way I am a good boy (lol) and I'll explain you how to do similar things:
IF YOU HAVE A CUSTOM LEADERBOARD:
If you have a custom leaderboard, then you are supposted to have a custom team value too as a String Value (this is important), let's name it "Team", now we need to check in what team is the player in.
First of all we need to declare some variables:
local players = game.Players:GetChildren() -- This will get EVERY player inside the server local redGun = game.Lighting.RedishGun -- The Redish Gun, I assume that you have it in the lighting, if the name is wrong just change "RedishGun"to your redish gun real name, remember CaSe SeNsItIvE! local blueGun = game.Lighting.BluishGun -- Same as the Redish one local playerteam -- The player team, we need to set it from our next check function =) local thePlayer -- The player, it will be defined in the next function =)
Those are all the variables we need, now we need to make a player check.
-- The function will be called as soon as the player join the game game.Players.PlayerAdded:connect(function(player) for _, player in pairs(players) do thePlayer = player -- The field is the same as minecraft's one (little EE). local team = player:FindFirstChild("Team") -- We search for the "Team" value if team then playerteam = team.Value end end end)
Ok, now that we have the player team we need to give the guns! That's easy =)
function giveWeapons() -- We wait for the StarterPack to be loaded, or we will get a nil error player:WaitForChild("StarterPack") -- If the team is "Red" then.... that's why you need to use StringValue! if playerteam == "Red" then redGun:Clone().Parent = player.StarterPack elseif playerteam == "Blue" then blueGun:Clone().Parent = player.StarterPack end end
Now we need to call it in our player checker method! Add this line inside the team checker
if team then -- Call here the "giveWeapons" function giveWeapons() -- Add this line, not the condition (lol) end
That's it!
WARNING: the code hasn't been tested, it may have some problems, PM me if you don't know how to resolve they =)
WAIIIIIITT!
IF YOU DON'T HAVE A CUSTOM LEADERBOARD:
Just put the models inside the teams in "Teams" service.
Closed as Not Constructive by evaera
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?