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

Trying to make myself invisible to just one USER with a lock system?

Asked by 3 years ago
Edited 3 years ago

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!

0
I think it is uppercase Z JustinWe12 723 — 3y
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 TheUltimateTNTFriend 109 — 3y
0
also what justin said. u kinda need uppercase i had to figure that the hard way TheUltimateTNTFriend 109 — 3y
0
The targett is not a type, about the uppercase Z I will try it now. Fixer1987 95 — 3y

Answer this question