Invisibility button not working

Okay so my GUI looks like this by the way everything works except Invisibility.
Trying to make it were everyone sees you as invisible.
Also code is below image.

image


Player = script.Parent.Parent.Parent.Parent.Character

function click()
	Player.Head.Transparency = 1
	Player.RightLeg.Transparency = 1
	Player.LeftLeg.Transparency = 1
	Player.LeftArm.Transparency = 1
	Player.RightArm.Transparency = 1
	Player.Torso.Transparency = 1
	Player.face.Transparency = 1

end

script.Parent.MouseButton1Click:connect(function() click() end)
1 Like

If this is a LocalScript, it won’t show to other players. You’ll need to use RemoteEvents.
If this is a Script, they can’t listen for UI clicks.

Thank you I’ll try doing that.

So I’m confused on how that would work like can you try showing an example or something like that if so thank you.

You should change the first line to

local Player = game.Players.LocalPlayer.Character

1 Like

Making it the local player wouldn’t that be for client only?

--LocalScript
local ReplicatedStorage = game:GetService("ReplicatedStorage");

local invisEvent = ReplicatedStorage:WaitForChild("remote event name here");

function onClick()
	invisEvent:FireServer();
end

script.Parent.MouseButton1Click:Connect(onClick);
--ServerScript
local ReplicatedStorage = game:GetService("ReplicatedStorage");

local invisEvent = ReplicatedStorage["remote event name here"];

function onInvisEventFired(plr)
	local char = plr.Character;
	
	for _, v in next, char:GetChildren() do
		if v:IsA("BasePart") then --Checks if it's a body part
			v.Transparency = 1; --Makes the body part invisible
			
			if v.Name == "Head" then
				v.face.Transparency = 1; --Makes the face invisible
			end
		end
	end
end
invisEvent.OnServerEvent:Connect(onInvisEventFired);

I’d recommend implementing some security measures on the event firing, but I’m not sure how your admin gui works.

Yes because exploiters could use something to use the remote event.

Making it to local player makes the client’s Character invisible to other people and to the client itself.

So I’ve put all scripts where they should go nothing is happing I’m confused.
Also output.

Have you made a RemoteEvent in ReplicatedStorage and named it properly?

I already had one ready for it.

Are you sure you named the character children correctly because i noticed they had no space. eg- Player.LeftLeg.Transparency = 1

but in the character, its Left Leg with a space.

Well i dont know how it would work with a space.

Is that the full output message? There should be an error in red text somewhere above that

Yeah i know but like there isnt when i click it just stack begin thats all.

Let me try again to see output.

So basically, i just put a starter character in the starter player and changed the children to the same name with out no space and then tried your script and put it on a gui and it works.

Well I’m trying it so there’s no starter character🤔

give me a sec, i’ll fix your script and send it to you

1 Like