Hey, so I'm making a GUI that allows you to change shirt upon pressing a button. After finishing up I went to test on a local server so I could see the script working on other players, but I could see the script only worked locally (on the player who pressed the button's screen) and his clothes were being removed. How would I fix this?
script.Parent.Activated:Connect(function() local player = script.Parent.Parent.Parent.Parent.Parent --plr name local p = script.Parent.Pants.PantsTemplate --pants are being stored in parent local s = script.Parent.Shirt.ShirtTemplate --shirts are being stored in parent local foundShirt = player.Character:FindFirstChild("Shirt") -- Tries to find Shirt if not foundShirt then -- if there is no shirt print("No shirt found, creating for "..player.Name) local newShirt = Instance.new("Shirt",player.Character) newShirt.Name = "Shirt" else if foundShirt then -- if there is a shirt print("Shirt found, reconstructing for "..player.Name) player.Character.Shirt:remove() local newShirt = Instance.new("Shirt",player.Character) newShirt.Name = "Shirt" end end
I have this hooked up to a text button. Thanks.
You must change it on the server, or use FilteringEnabled false (unsupported for good reason).
Use RemoteEvents:
https://developer.roblox.com/en-us/articles/Roblox-Client-Server-Model
https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events
https://developer.roblox.com/en-us/api-reference/class/RemoteEvent