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

How do I make clothing change globally instead of locally?

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.

1 comment

1

Anytime you want something to happen "globally"(on the server) you must run it on the server. Here' is a good resource you help you out. https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

1 answer

✓ Accepted answer

4 comments

0

Thanks. I used a remote event to trigger the script.

0

Glad I could help. :)

0

FilteringEnabled can't be false

0

"unsupported for good reason"

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