Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make Group members spawn with tools according to rank?

I am trying to make a game where players in my group need a keycard to open doors, does anyone knows how to make group members spawn with keycards according to their rank? So that the first rank would spawn with a low-level card, and the owner would spawn with a high-level card. Anything would help.

1 answer

You need to create teams first, or either put string values or bool values in players.

Put this in the workspace, this is a normal script, not local, not module. All you need to do is to put the tool under the team. I've found this script and added 3 lines.

Source: https://www.youtube.com/watch?v=nGtuKbcjPXg

--Just put weapons in the team.
local Players = game:GetService("Players")
local low = game.Teams.Low -- This is the default team, when joining players will automatically join that team.

Players.PlayerAdded:Connect(function(player)
	player.Team = low -- Change the team name
end)


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)

In Order to create keycard doors, create a tool, and put a part / Union, recommended Union in order to create a detailed one.

then create a door and put this in the door / part.



-- Unlocks Door
script.Parent.Touched:connect(function(p)
	if p.Parent.Name == "Tool" then -- Rename to whatever part it is.
		script.Parent.Transparency = 0.5
		script.Parent.CanCollide = false
		wait(1)
		script.Parent.Transparency = 0
		script.Parent.CanCollide = true
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.