You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
-
Im trying to achieve giving certain teams items
-
What is the issue? Include screenshots / videos if possible!
-
Really dont know. Wont give me any errors
-
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
-
I looked online.
-
creator hub.
-
and a couple tut. (None of these works. I did write the code myself though)
local Players = game:GetService(“Players”)
local Teams = game:GetService(“Teams”)
local ServerStorage = game:GetService(“ServerStorage”)
local ReplicatedStorage = game:GetService(“ReplicatedStorage”)
local Keycard = ServerStorage:WaitForChild(“Keycard”, 5)
local Cuffs = ServerStorage:WaitForChild(“Cuffs”, 5)
local function isTeamAllowed(team)
for i, allowedTeam in ipairs(Teams) do
if team == allowedTeam then
return true
end
end
return false
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local backpack = player:FindFirstChild(“Backpack”)
if isTeamAllowed(player.Team) then
if Keycard and not backpack:FindFirstChild("Keycard") then
Keycard:Clone().Parent = backpack
print("Gave " .. player.Name .. " Keycard")
end
if Cuffs and not backpack:FindFirstChild("Cuffs") then
Cuffs:Clone().Parent = backpack
print("Gave " .. player.Name .. " Cuffs")
end
end
end)
end)
Im not asking for an entire script. but please give me feedback on what I should do