Roblox Scripting Tutorial: Giving Different Teams Different Weapons
Script:
--Just put weapons in the team.
function teamFromColor(color)
for _,t in pairs(game:GetService("Teams"):GetChildren()) do
if t.TeamColor==color then return t end
end
return nil
end
function onSpawned(plr)
local tools = teamFromColor(plr.TeamColor):GetChildren()
for _,c in pairs(tools) do
c:Clone().Parent = plr.Backpack
end
end
function onChanged(prop,plr)
if prop=="Character" then
onSpawned(plr)
end
end
function onAdded(plr)
plr.Changed:connect(function(prop)
onChanged(prop,plr)
end)
end
game.Players.PlayerAdded:connect(onAdded)
Be sure to follow me on Twitter after rating, commenting, and subscribing!
https://twitter.com/Rrrrry123
Also, follow me on Twitch for some live streams!
http://www.twitch.tv/Rrrrry123
Want to help make this channel better? You can donate to me via Roblox Robux!
http://ow.ly/En9x30hdeWy
Other great YouTubers!
Valiant Fella: http://ow.ly/zZUfu
Leo Iizuka: http://ow.ly/A5grV
MissAdorkableBubbles: http://ow.ly/BNhxx
Other Videos By RyGuyGaming
Other Statistics
Roblox Statistics For RyGuyGaming
At present, RyGuyGaming has 459,946 views spread across 106 videos for Roblox, and roughly a days worth of Roblox videos were uploaded to his channel. This makes up 17.76% of the content that RyGuyGaming has uploaded to YouTube.