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

Why does changing Shirts/Pants only work in Test mode?

Nothing shows in the output. I thought about doing a .Changed but I don't know how to apply it.

It is a normal script in a TextButton

local Player = script.Parent.Parent.Parent.Parent.Parent

function onClick()
	script.Parent.Parent.Visible = false
	Player.Character.Shirt.ShirtTemplate = "http://www.roblox.com/asset/?id=261394422"
	Player.Character.Pants.PantsTemplate = "http://www.roblox.com/asset/?id=261394385"
end
script.Parent.MouseButton1Click:connect(onClick)

2 answers

✓ Accepted answer

Without using script.Parent.Parent.Parent.Parent.Parent you could just stick to the LocalPlayer, this property of Players gains access to the localplayer . Next, you should Double check if you are indexing your variables or code correctly. Also use a localscript when using GUIs.

Note: A normal ServerScript can Not use localplayer.

1 comment

0

Thanks! But now the clothes are only visible to that player.

local player = script.Parent.Parent.Parent.Parent.Player
--try this instead.
-- or script.Parent.Parent.Parent.Parent.Parent.Player

I basically know this is the same thing as your variable but this might work unless not.

local player = game.Players.LocalPlayer
--Try using localscript for this type.

I've done your script but except it's like Parent.Player, not Parent.Parent.Parent.Parent.Parent and it works for me even without test mode. But again, it might just be roblox's update or something else. I've hope this helped you!

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