I am building a tycoon and I need help building a team only tool giver. I wanna be able to set it to a specific team and so when a player touches it, only the people with the same team color can take it. I also want it to set it to their starter pack.
I have no idea how to even start building this could I get some help?
1 Always keep this inside the game :) 2 just put the tool you want to give to the teams into their team under the Teams section
PUT In TO A Script
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 = fromTeamCOlor(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)
Hope this helps!