Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to change players clothes when text button is clicked?

Step 1 : Player clicked button Step 2 : My text button fire remote event called "team" Step 3 : I have 2 scripts in serverscriptservice , one for team change another for clothes change Step 4 : My team change script works perfectly Step 5 : My clothes change doesnt work but does not give any error

This script is to change the clothes of the player and obviously it bugged.

local players = game:GetService("Players")
local plr = players.LocalPlayer
local plrteam = game:GetService("Teams").Red

game.ReplicatedStorage.Team.OnServerEvent:Connect(function(plry)
	if plry.Team == plrteam then
local plr = game.Players.LocalPlayer
local function change()
    if game.plr.Character:FindFirstChild("Shirt") then
        game.plr.Character.Shirt:Destroy()
    end
    if game.plr.Character:FindFirstChild("Shirt Graphic") then
        game.plr.Character:FindFirstChild('Shirt Graphic'):Destroy()
    end
    if game.plr.Character:FindFirstChild("Pants") then
        game.plr.Character.Pants:Destroy()
    end

    local Shirt = Instance.new('Shirt',game.Players.LocalPlayer.Character)
    local Pant = Instance.new('Pants',game.Players.LocalPlayer.Character)

    Shirt.ShirtTemplate = "rbxassetid://144076357"
        Pant.PantsTemplate = "rbxassetid://144076759"
change()
	  end
   end
end)

Here is my code. I tried debugging it for half an hr until there is no output error but it still isnt working. Help would be appreciated. Thanks in advance!

2 comments

0

Use this format : "http://www.roblox.com/asset/?id=PUT ID HERE"

0

It doesnt work as well. Output no error

1 answer

This discussion is preserved as it was. New answers, comments, and votes are closed.