Yo. I tried making a script that makes me invisible to just one player, using a lock system and a ClientEvent. Didn't work, no errors appear. Here's the code:

LOCK SYSTEM

local players = game.Players
local player = players.LocalPlayer
local mouse = player:GetMouse()  
local plrtarget = player.PlayerGui.Values.Targett

mouse.KeyDown:connect(function(key)
	if key == "l" then
		local target = mouse.Target
		local plr = players:GetPlayerFromCharacter(target.Parent)
		if plr then
			print(plr.Name)
			plrtarget.Value = plr.Name
		end
	end
end)

LOCAL SCRIPT FOR DISAPPEARING

local players = game.Players
local player = players.LocalPlayer
local mouse = player:GetMouse()  

mouse.KeyDown:connect(function(key)
	if key == "z" then
		print("DISAPPEAR GO")
	 --if player.Level.Value >= 5 then
		local target = player.PlayerGui.Values.Targett.Value
		game.ReplicatedStorage.RemoteEvents.InvisibilitySkill.Disappear:FireServer(target)
	 --end	
	end
end)

SERVERSCRIPT

game.ReplicatedStorage.RemoteEvents.InvisibilitySkill.Disappear.OnServerEvent:Connect(function(player, target)
	print("DISAPPEAR ARRIVED AND GOES AGAIN")
	game.ReplicatedStorage.RemoteEvents.InvisibilitySkill.Disappear1:FireClient(target, player)
end)

LOCAL SCRIPT

game.ReplicatedStorage.RemoteEvents.InvisibilitySkill.Disappear1.OnClientEvent:Connect(function(target, player)
	local db = false
	local Character = player.Character
	print("DISAPPEAR ARRIVED")
	print(player.Name)
	if db == false then
		db = true
		for i,v in pairs(Character:GetDescendants()) do -- loop through everything in the character
			if v:IsA("BasePart") or v:IsA("Decal") then -- if it is a part
				v.Transparency = 1 -- make it invisible
			end
		end
	else
		db = false
		for i,v in pairs(Character:GetDescendants()) do -- loop through everything in the character
			if v:IsA("BasePart") or v:IsA("Decal") then -- if it is a part
				v.Transparency = 0 -- make it invisible
			end
		end
	end
end)

Help please!

4 comments

0

I think it is uppercase Z

0

in the lock script you wrote playertarget when there is no object and u also wrote player.playergui.values.targeTT maybe its the typos

0

also what justin said. u kinda need uppercase i had to figure that the hard way

0

The targett is not a type, about the uppercase Z I will try it now.