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

This script works in an empty baseplate, but not when I put it in another game. Why?

Asked by 7 years ago
Edited 7 years ago

So I started off by using this script in an empty baseplate, and it worked perfectly fine. When I put the script in a game that has been published, it won't work. Not sure why.. I tried deleting all the other scripts in that game as well, to no avail. I am desperately stuck, please help.

Here is my code:

local shirts = {
    ["1"] = "815849208",
    ["2"] = "815849208",
    ["3"] = "815846079",
    ["4"] = "815845414",
    ["5"] = "815844264",
    ["6"] = "815843610",
    ["7"] = "815843104",
    ["8"] = "815841847",
    ["9"] = "815861890",
    ["10"] = "815834264",
    ["11"] = "815833715",
    ["12"] = "815832708",
    ["13"] = "815831516",
    ["14"] = "815831516",
    ["15"] = "815831516",
    --["255"] = "447555674",
}
local pants = { --subtract 1 from pants id until you get an image of the net
    ["1"] = "815847370",
    ["2"] = "815847370",
    ["3"] = "815847370",
    ["4"] = "815847370",
    ["5"] = "815847370",
    ["6"] = "815847370",
    ["7"] = "815847370",
    ["8"] = "815835761",
    ["9"] = "815835761",
    ["10"] = "815835761",
    ["11"] = "815835761",
    ["12"] = "815835761",
    ["13"] = "815835761",
    ["14"] = "815835761",
    ["15"] = "815835761",
    --["255"] = "447555803"
}

game.Players.PlayerAdded:connect(function(p)
    if p:IsInGroup(3236293) then  --Unpoke wanted to be added to this
        p.CharacterAdded:connect(function(char)
            wait(1)
            if char:FindFirstChild("Shirt") then
                char.Shirt:Destroy()
            end

            if char:FindFirstChild("Pants") then
                char.Pants:Destroy()
            end

            local rank = p:GetRankInGroup(3236293)
            local shirt = "http://www.roblox.com/asset/?id="..shirts[tostring(rank)]
            local pants = "http://www.roblox.com/asset/?id="..pants[tostring(rank)]--heres the other part

            local newShirt = Instance.new("Shirt",char)
            newShirt.ShirtTemplate = shirt

            local newPants = Instance.new("Pants",char)
            newPants.PantsTemplate = pants

        end)
    end
end)

(I commented out the owner's Shirt and Pants to test the script.)

0
FilteringEnabled? BlackOrange3343 2676 — 7y
0
You should use WaitForChild instead of FindFirstChild Goulstem 8144 — 7y
0
Still ain't working.... BartyCrouchJunior 57 — 7y
0
For some clarification on the issue, when I put the script in a game that has been published, it won't work. Not sure why. BartyCrouchJunior 57 — 7y
View all comments (4 more)
0
Hm... maybe try editing the Shirt/Pants that are already there? No need to destroy and create new ones, really. Goulstem 8144 — 7y
0
Why did you make a dictionary for the ids? Just make a table ;-; KingLoneCat 2642 — 7y
0
He probably made a dictionary for the ranks. LordProxius 17 — 7y
0
How does the script not work? Does something different? (If yes, what?) Does it display an error message? (If yes, what is it?) Does it just not run? Provide more detail pls RiskoZoSlovenska 378 — 7y

Answer this question