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

How to make players wear clothes if they click on a GUI button?

Asked by
iSEANxo -1
7 years ago

I'm trying to make a catalog which allows players to change their clothing. Here's what I've came up with so far, any suggestions on how to make it work?

P.s I haven't been trying to script for long so expect noob mistakes lol

local player = game.Players.LocalPlayer
local shirt = game.ServerStorage:findFirstChild("Shirt")
local pants = game.ServerStorage:findFirstChild("Pants")
debounce = true

function Click()
local clothing = player.Character:GetChildren()

if clothing.className == "Pants" or clothing.className == "Shirt"  then
clothing:destroy()

shirt:Clone().Parent = player.Character
pants:Clone().Parent = player.Character

end
end

script.Parent.MouseButton1Down:connect(Click)

2 answers

Log in to vote
0
Answered by 7 years ago

Here, you should be able to edit the clothes and where you click it. It is a local script so it works with filteringEnabled!

script.Parent.MouseButton1Down:connect(function()
local playername = game.Players.LocalPlayer.Name
local player = workspace:FindFirstChild(""..playername.."")
if player ~= nil then
  player:FindFirstChild("Pants").PantsTemplate = "http://www.roblox.com/asset/?id=0000000" 
  player:FindFirstChild("Shirt").ShirtTemplate = "http://www.roblox.com/asset/?id=0000000"
end
end)
0
Perfect! Thank you so much iSEANxo -1 — 7y
0
You should use game.Players.LocalPlayer.Character instead of finding the character by name. Programical 653 — 7y
Ad
Log in to vote
0
Answered by 3 years ago

Im a noob at scripting and i dont exactly know how this app nor how scripting works. could you help me do something like: https://devforum.roblox.com/uploads/default/original/4X/3/5/4/354d8add883b4317f87861151d08fb0291355a6c.png

i dont know how to get that box either. if you could help that would be SOO helpful!!!!

Answer this question