I wanna make a text button that removes your characters shirt when clicked. I dont see why it wont work? I know for a fact the local char is referenced correct so what is the issue?
local char = script.Parent.Parent.Parent.Parent.Parent.Parent.Character
script.Parent.MouseButton1Down:Connect(function()
char.Shirt:Destroy()
end)
is that script in a localscript? only localscripts can detect if a GUI button has been pressed. if it is in a localscript you can do something like this
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait() -- gets the local players character
script.Parent.MouseButton1Down:Connect(function()
local shirt = char:FindFirstAncestorWhichIsA("Shirt") -- finds to see if the shirt exists
if shirt then
shirt:Destroy() -- will only destroy the shirt on the players screen, no one elses
end
end)