Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why won't this uniform script work?

Asked by 10 years ago
wait(0.1)

local groupid = script.Configuration.GroupID

local players = game:GetService('Players')
local player = game.Players.LocalPlayer

local config = script.Configuration

local shirt = script.Configuration.Shirt
local pants = script.Configuration.Pants


function SpawnClothes(Players)
if Players:IsInGroup(groupid.Value) then
for i,v in pairs(Players.Character:getChildren()) do
if v.className == "Shirt" or v.className == "Pants" then
v:remove()
end
end
script.Configuaration.Shirt:Clone()
shirt.Parent = Players.Character
script.Configuaration.Pants:Clone()
pants.Parent = Players.Character
end
end
function PlayerRespawned(Player)
SpawnClothes(Player)
Player.Changed:connect(function(property) 
if (property == "Character") then 
SpawnClothes(Player) 
end
end)
end
game.Players.ChildAdded:connect(PlayerRespawned)

Can someone tell me why this won't work?

1 answer

Log in to vote
0
Answered by 10 years ago

Might have been just a simple error. Is the configuration in the script or a parent? If not, I would do; Then, put shirts and pants in the script. Also, put your group ID in the if Playerz:IsInGroup(0) then

function SpawnClothes(Playerz)
if Playerz:IsInGroup(80738) then --Group ID
for i,v in pairs(Playerz.Character:getChildren()) do
if v.className == "Shirt" or v.className == "Pants" then
v:remove()
end
end
Shirt = script.Shirt:clone()
Shirt.Parent = Playerz.Character
Pants = script.Pants:clone()
Pants.Parent = Playerz.Character
end
end

function PlayerRespawned(Player)
SpawnClothes(Player)
Player.Changed:connect(function(property) 
if (property == "Character") then 
SpawnClothes(Player) 
end
end)
end

game.Players.ChildAdded:connect(PlayerRespawned)
Ad

Answer this question