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

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

Asked by 9 years ago

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

Log in to vote
0
Answered by
woodengop 1134 Moderation Voter
9 years ago

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.

<html> </html>

0
Thanks! But now the clothes are only visible to that player. GianniKun 40 — 9y
Ad
Log in to vote
0
Answered by 9 years ago
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!

Answer this question