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

Can someone help me with this localscript that makes a certain team morph?

Asked by 10 years ago

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

I have a localscript inside of a script that should clone it into the all the players on the teamcolor "Medium Green" Here is the localscript.

while true do
    local Player = LocalScript.Parent
if Player ~= nil then
    Player.TeamColor = game.Teams.Zombies.TeamColor
    Player:WaitForChild("Shirt")
Player.Shirt:Destroy()
    Player:WaitForChild("Pants")
Player.Pants:Destroy()
    Player:WaitForChild("BodyColors")
b=Player.BodyColors
    b.HeadColor = "Medium Green"
b.LeftArmColor = "Medium Green"
    b.LeftLegColor = "Brown"
b.RightArmColor = "Medium Green"
    b.RightLegColor = "Brown"
b.TorsoColor = "Brown"
    Player:WaitForChild("ShirtGraphic")
Player.ShirtGraphic:Destroy()
for _, v in pairs(Player:GetChildren()) do
    if v:IsA("Accoutrement") then
     v:Destroy()
Player:WaitForChild("CharacterMesh")
Player.CharacterMesh:Destroy()

end
    end
end

Instance.new("Hat",Player)
    Instance.new("Part",Player.Hat)
Instance.new("Mesh",Player.Hat)
m=Player.Hat.Part.Mesh
        m.MeshId = ("rbxassetid://24477146")
    m.TextureId = ("rbxassetid://25289515")
    Instance.new("CharacterMesh",Player)
    Player.CharacterMesh:WaitForChild()
        Player.CharacterMesh.Name = "LeftArm"
        Player.LeftArm.MeshId = ("rbxassetid://24477146")
            Player.LeftArm.OverlayTextureId = ("rbxassetid://37686282")

            Instance.new("CharacterMesh",Player)
    Player.CharacterMesh:WaitForChild()
        Player.CharacterMesh.Name = "LeftLeg"
        Player.LeftArm.MeshId = ("rbxassetid://37683150")
            Player.LeftArm.OverlayTextureId = ("rbxassetid://37687646")

            Instance.new("CharacterMesh",Player)
    Player.CharacterMesh:WaitForChild()
        Player.CharacterMesh.Name = "RightArm"
        Player.LeftArm.MeshId = ("rbxassetid://37683174")
            Player.LeftArm.OverlayTextureId = ("rbxassetid://37686282")

            Instance.new("CharacterMesh",Player)
    Player.CharacterMesh:WaitForChild()
        Player.CharacterMesh.Name = "RightLeg"
        Player.LeftArm.MeshId = ("rbxassetid://37683227")
            Player.LeftArm.OverlayTextureId = ("rbxassetid://37687646")

            Instance.new("CharacterMesh",Player)
    Player.CharacterMesh:WaitForChild()
        Player.CharacterMesh.Name = "Torso"
        Player.LeftArm.MeshId = ("rbxassetid://37683263")
            Player.LeftArm.OverlayTextureId = ("rbxassetid://0")






end
    end
end

0
What is the question here? BlueTaslem 18071 — 10y
0
it's not working properly, and I need to know what's wrong with it. zachhg03 35 — 10y

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

You have a syntax error. If you used your output, you would know this.

If you tabbed your code properly, that syntax error would be obvious:

    ....

    Instance.new("CharacterMesh",Player)
    Player.CharacterMesh:WaitForChild()
    Player.CharacterMesh.Name = "Torso"
    Player.LeftArm.MeshId = ("rbxassetid://37683263")
    Player.LeftArm.OverlayTextureId = ("rbxassetid://0")
end
end
end

You have three consecutive ends at the same level of indentation at the end of the script. The last two are superfluous and incorrect. Remove them.


On the second line of your script, you refer to LocalScript which is not defined.

script refers to the currently executing Script object -- this is ALSO the variable used in LocalScripts -- it does not change. Use script instead:

while true do
    local Player = script.Parent
    if Player ~= nil then
        Player.TeamColor = game.Teams.Zombies.TeamColor

        ...
Ad

Answer this question