Why doesn't this certain rank in the group not get the shirt, pants and tazer? And why doesn't the sound play?

function onPlayerAdded(player)
	script.Sound:Play()
	if player:IsInGroup(2608221) and player:GetRoleInGroup(2608221) == 118 or player:GetRoleInGroup(2608221) == 226 then
		local t = script.Tazer:Clone()
		if player.Character.Shirt and player.Character.Pants then		
		t.Parent = player.Backpack		
		player.Character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=264345994"
		player.Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=264346071"
		else
	    local a = Instance.new("Shirt", player.Character)
        a.ShirtTemplate = "http://www.roblox.com/asset/?id=264345994" 
        local a = Instance.new("Pants", player.Character)
        a.PantsTemplate = "http://www.roblox.com/asset/?id=264346071" 
		t.Parent = player.Backpack
	end
	end
	end
	
	game.Players.PlayerAdded:connect(onPlayerAdded)

3 comments

0

Is this a Localscript, If not change it to a Local Script.

0

for the else, check if it has a shirt or a pants before it places it into the character. It may have a shirt and no pants.

0

@KenzaShadow It's in the serverscriptserve I can't do Insert Object and local script it doesn't say localscript