Don't you need to fix the part where it says TEST and make it so it knows it's a new instance?
This is the game pass one by ROBLOX, Maybe it would be possible to edit that and use it instead?
Just a suggestion
local function WaitForChild(parent, childName)
assert(parent, "ERROR: WaitForChild: parent is nil")
while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end
return parent[childName]
end
local GamePassService = Game:GetService('GamePassService')
local PlayersService = Game:GetService('Players')
local InsertService = Game:GetService('InsertService')
local LightingService = Game:GetService('Lighting')
local GamePassIdObject = WaitForChild(script, 'GamePassId')
local ToolAssetsToLoad = WaitForChild(script, 'ToolAssetsToLoad')
local AdminTools = LightingService:FindFirstChild('AdminTools')
local function CloneAdminTools(target)
for _, tool in pairs(AdminTools:GetChildren()) do
local toolClone = tool:Clone()
toolClone.Parent = target
end
end
local function OnPlayerAdded(player)
if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then
local starterGear = WaitForChild(player, 'StarterGear')
CloneAdminTools(starterGear)
if player.Character then
local backpack = WaitForChild(player, 'Backpack')
CloneAdminTools(backpack)
end
end
end
if not AdminTools then
AdminTools = Instance.new('Model')
AdminTools.Name = 'AdminTools'
for _, intObject in pairs(ToolAssetsToLoad:GetChildren()) do
if intObject and intObject:IsA('IntValue') and intObject.Value then
local assetModel = InsertService:LoadAsset(intObject.Value)
if assetModel then
local asset = assetModel:GetChildren()[1]
if asset then
asset.Parent = AdminTools
end
end
end
end
AdminTools.Parent = LightingService
end
PlayersService.PlayerAdded:connect(OnPlayerAdded)
1 comment
Is your script not working, or are you just wondering whether it should be a LocalScript or a Script? To answer that, it should be a server-side script.