#Hide Players Script

1 messages · Page 1 of 1 (latest)

leaden falcon
#

i made a script but everytime the player died you could see him again

#

i tried to add a function with CharacterAdded, to try and check everytime the player respawns but it just doesnt work

#

and im not sure if i wanna use like a true do loop instead or runService

#

could someone help ?

#

gtg eat ill come back

delicate roost
#

can you pass your script so we can check what its the problem?

polar yew
#

do a for loop through the players then continue if the player is the local player then loop through their character and set all meshes or accsessories transparency to 1

leaden falcon
leaden falcon
#

rage quit

#

sory

#

🥀

#

imma try to remake the script

leaden falcon
#

no

#

not that

#

character added

#

wait

#

lemme verify

#

yea

#

CharacterAdded

delicate roost
# leaden falcon CharacterAdded

what you really want to track is when a player is added, and then to that player that was added track the character added, also before this loop through all the actual players characters

leaden falcon
#

so like

#

create a table

#

and when a player joins

#

put him in that table

delicate roost
#

what table

#

xd

#

the structure would be like

#

you turn it on

leaden falcon
#

this thing :
local name = {}

delicate roost
#

:
first of all loop trhough all the characters of all the actual players, from that just detect when a player is added and detect his character added

delicate roost
#

not needed

leaden falcon
#

ok im not sure i understand can i send my actual code ??

delicate roost
#

ok

leaden falcon
#

how can i send it and it looks good

#

??

delicate roost
#

``

leaden falcon
#
local ScreenGui = script.Parent
local MenuButton = ScreenGui:WaitForChild("OpenMenu")
local settingsMenu = ScreenGui:WaitForChild("Menu")
local closeSettings = settingsMenu.MenuCloser
local SF = settingsMenu.ScrollingFrame
local SkyChanger = SF.Skychanger.TextButton
local Skies = SF.Skychanger.Skies
local on = false
local hidePlrButton = SF.HidePlayers.Button
local player = game.Players.LocalPlayer
local character = player.Character

MenuButton.Activated:Connect(function()
    MenuButton.Visible = false
    settingsMenu.Visible = true
end)

closeSettings.Activated:Connect(function()
    MenuButton.Visible = true
    settingsMenu.Visible = false
end)

SkyChanger.Activated:Connect(function()
    if not on then
        Skies.Visible = true
        on = true
    else
        Skies.Visible = false
        on = false
    end
end)

hidePlrButton.Activated:Connect(function()
    if not on then
        on = true
        -- hide the players
        for _, player in pairs(game.Players:GetPlayers()) do
            if player.Character then
                for _, parts in pairs(player.Character:GetDescendants()) do
                    if parts:IsA("BasePart") or parts:IsA("Decal") then
                        parts.LocalTransparencyModifier = 1
                    elseif parts.Name == "Nametag" then
                        parts.Enabled = false
                    end
                end
            end
        end
    else
        on = false
        -- show the players
        for _, player in pairs(game.Players:GetPlayers()) do
            if player.Character then
                for _, parts in pairs(player.Character:GetDescendants()) do
                    if parts:IsA("BasePart") or parts:IsA("Decal") then
                        parts.LocalTransparencyModifier = 0
                    elseif parts.Name == "Nametag" then
                        parts.Enabled = true
                    end
                end
            end
        end
    end
end)
#

i have multiple things in the script tho

delicate roost
#

first of all you're using the variable on for both hideplayer button and skychanger

leaden falcon
#

oh sh

#

didnt notice that

#

lemme repair that

delicate roost
#

ngl I don't know how to explain it well

#

I mean I can do an example script if you want

leaden falcon
#

yes

#

pls

#

or just

#

tell me

#

where to add the player added event

eternal yarrow
#

just make a count player function

#

and then do a main loop that calls it every so often

leaden falcon
#

like

#

a true do loop ??

eternal yarrow
#

yh

leaden falcon
#

but i dont wanna use that

eternal yarrow
#

put but a task.wait on it

#

why>

leaden falcon
#

its not optimal and i dont like it

eternal yarrow
#

okay then just make a countplayer function and call it within your other function

leaden falcon
#

wait

#

a functions that contains all the players ??

eternal yarrow
#

just make a table

leaden falcon
#

yea

eternal yarrow
#

local Players = {}

#

then make a count function

leaden falcon
#

thats what i proposed first but then the other guy said not to do that

eternal yarrow
#

idk why?

leaden falcon
#

me neither

#

💀

#

ill wait for him to show me the script

#

he said hes gonn show me an exemple script

eternal yarrow
#

id just do something like that

#

nvm

#

ignore that

leaden falcon
#

why ??

#

i was about to try it

eternal yarrow
#

local PlayerTable:{Player}={}
local Players = game:GetService("Players")

local function CountPlayers()

table.clear(PlayerTable)
local PlayersInGame = Players:GetPlayers()
table.insert(PlayerTable,PlayersInGame)
print(PlayerTable)

end

CountPlayers()

#

something like that

delicate roost
#

nah

#

ngl

ancient valve
#
local test = test
#

oh it worked

delicate roost
#

I'm doing the example code and not to call you noob or smth but I don't know if you gonna understand all

ancient valve
#

did he use ai to script

delicate roost
#

because last time I did this exactly functionality I was bad and well now that I'm doing it again I see the fails and doing more complex things

eternal yarrow
#

local test = test

#

idk how u made it ed

ancient valve
#

add lua to the start

#

and lay it out like this

leaden falcon
leaden falcon
#

cause if its in a local script its only going to save players that join after you joined

leaden falcon
#

ok i tried to implement smtg like that

#

still doesnt work