I've made a script that changes your t-shirt when you click a textbutton, it works fine in studio but doesn't work at all, saying that everything is a nill value. I've tried the script in both a localscript and a standard one with no prevail. Can someone help me?
This is the script:
local decal = script.Parent:findFirstChild("Decal") local hit = game.Players.LocalPlayer local humanoid = hit.Character:findFirstChild("Humanoid") local torso = hit.Character:findFirstChild("Torso") function GetFace() if torso ~= nil and humanoid ~= nil then local shirt = hit.Parent:findFirstChild("Shirt Graphic") if shirt ~= nil then shirt.Graphic = decal.Texture else local altshirt = torso:findFirstChild("roblox") if altshirt ~= nil then altshirt.Texture = decal.Texture else print("Torso found. Shirt not found. Assumed to be a robot.") end end else print("Not a valid person! T-Shirt cannot be changed!") end end script.Parent.MouseButton1Click:connect(GetFace)
Your issue is that you are attempting to call LocalPlayer in a ServerScript.
Simply converting your script to a localscript should do the trick.