Hey there,
I am currently developing a game and it has a roleplay aspect. So when a player joins a team they should receive specific tools. Currently the script is not working and i am not getting output errors.
One of the solutions i tried was the :GetPropertyChangedSignal()
event but that didnt work.
Here is the current script that i am using:
local teams = game:GetService("Teams")
local serverStore = game.ServerStorage
local hk416Mod = serverStore["HK416 Mod"]
local player = game.Players.LocalPlayer
local function checkTeam()
if player.Team == teams["The Delta Brotherhood"] then
local hk416ModClone1 = hk416Mod:Clone()
local hk416ModClone2 = hk416Mod:Clone()
if player.StarterTools and player.Backpack then
hk416ModClone1.Parent = player.StarterTools
hk416ModClone2.Parent = player.Backpack
else wait(10)
print("Checking if player has a backpack or startertools yet...")
if player.StarterTools and player.Backpack then
print("Player's startertools and backpack have loaded, giving tools...")
hk416ModClone1.Parent = player.StarterTools
hk416ModClone2.Parent = player.Backpack
else
print("Player still does not have a backpack or startertools...")
player:Kick("Your backpack and/or startertools did not load, if this problem happens again please report the bug.")
end
end
end
end
while true do -- Using a while true do loop since it will be the only code that needs to run after the functions are created
checkTeam()
wait(1)
end
I am not too sure why the players dont receive the tools.
This script is located within the ServerScriptService.
Thanks for the help!