Hello, I’m creating this topic because I’m mainly a builder but I need help for know how to make a script that would delete a specific tool when you’re on a specific team.
For explain fast, we’re a group with clearance etc… and there’s a team named Class-D which are test subjects. Our personnel are able to join this team but they still get their cards due to a script that automaticaly giving you the card that you need according to your clearance, which can represent a problem as they can easily go out of their cell.
I apologize for my grammars and vocabulary mistakes, and I’m saying thanks to whoever will help me to solve this problem with a script…
Maybe It’s an easy script to make but I don’t have the necessary knowledge for that.
In the future, when posting code on the forum, please post it as text, not a photo
You can search posts about posting code on the forum.
Firstly, your team changer script can be exploited since it’s only doing checks on the client.
Gui Manager
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeamChangeEvent = ReplicatedStorage:WaitForChild("TeamChanger")
local Buttons = script.Parent.Main:GetChildren()
for i, Button in ipairs(Buttons) do
if v:IsA("TextButton") then
v.MouseButton1Click:Connect(function()
TeamChangeEvent:Fire(v.Text)
end
end
end
Team Changer
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Teams = game:GetService("Teams")
local TeamChangeEvent = Instance.new("RemoteEvent")
TeamChangeEvent.Name = "TeamChanger"
TeamChangeEvent.Parent = ReplicatedStorage
local GroupSettings = { --put the name of all the buttons in here and put the minimum rank value
["GroupId"] = 0 --put group ID here
["Administrative Department"] = 10, --this is an example, just copy and paste
["Chaos Insurgency"] = 9,
--paste here
}
TeamChangeEvent.OnServerEvent:Connect(function(Player, Data)
if Player:GetRankInGroup(GroupSettings.GroupId) >= GroupSettings[Data] then
Player.Team = Teams[Data]
end
end
Ok so another question. What are the tools and which team gets which tool?
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetSettings("ServerStorage")
local Teams = game:GetService("Teams")
local TeamChangeEvent = Instance.new("RemoteEvent")
TeamChangeEvent.Name = "TeamChanger"
TeamChangeEvent.Parent = ReplicatedStorage
local TeamToolsFolder = ServerStorage:WaitForChild("TeamTools") --make a folder in server storage called "team tools" and place all tools in there
local GroupSettings = { --put the name of all the buttons in here and put the minimum rank value
["GroupId"] = 0 --put group ID here
["Administrative Department"] = 10, --this is an example, just copy and paste
["Chaos Insurgency"] = 9,
--paste here
}
local ToolSettings = { --these are the tools each team will have
["Administrative Department"] = {"[SCP] Card-Omni", "[SCP] Card-L5", "[SCP] Card-L4"}, --add other tool names
["Chaos Insurgency"] = {"[SCP] Card-L4"},
--add more here
}
TeamChangeEvent.OnServerEvent:Connect(function(Player, Data)
if Player:GetRankInGroup(GroupSettings.GroupId) >= GroupSettings[Data] then
Player.Team = Teams[Data]
if ToolSettings[Data] and #ToolSettings[Data] > 0 then
local Backpack = Player:WaitForChild("Backpack")
for i, Tool in ipairs(ToolSettings[Data]) do
local ToolClone = TeamToolFolder[Tool]:Clone()
ToolClone.Parent = Backpack
end
end
end
end
If there are any questions or errors, feel free to ask.
I’m sorry but there one wrong thing, my bad I guess I not explained well…
The script for give keycard to the player is already in but It’s like a script that give it to the player whatever his team. The thing that I don’t know It’s how to make it so when you are on Class - D team you can’t get these items
I’m sorry to bother you again as you’re helping me.
There is one main group with clearances that give you the following keycard according to the rank that you have in department (Like mobile task force etc…) so this why that we can’t give every keycard to a player)
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ServerStorage = game:GetSettings("ServerStorage")
local Teams = game:GetService("Teams")
local TeamChangeEvent = Instance.new("RemoteEvent")
TeamChangeEvent.Name = "TeamChanger"
TeamChangeEvent.Parent = ReplicatedStorage
local TeamToolsFolder = ServerStorage:WaitForChild("TeamTools") --make a folder in server storage called "team tools" and place all tools in there
local GroupSettings = { --put the name of all the buttons in here and put the minimum rank value
["GroupId"] = 0 --put group ID here
["Administrative Department"] = 10, --this is an example, just copy and paste
["Chaos Insurgency"] = 9,
--paste here
}
TeamChangeEvent.OnServerEvent:Connect(function(Player, Data)
if Player:GetRankInGroup(GroupSettings.GroupId) >= GroupSettings[Data] then
Player.Team = Teams[Data]
if Data ~= "Class - D" then
local Backpack = Player:WaitForChild("Backpack")
for i , Tool in ipairs(TeamToolFolder:GetChildren()) do
local ToolClone = Tool:Clone()
ToolClone.Parent = Backpack
end
end
end
end