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

Why doesn't this code work?

Asked by
Nidoxs 190
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

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)

0
Is this a Localscript, If not change it to a Local Script. KenzaXI 166 — 9y
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. HungryJaffer 1246 — 9y
0
@KenzaShadow It's in the serverscriptserve I can't do Insert Object and local script it doesn't say localscript Nidoxs 190 — 9y

Answer this question