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

how do i change properties in a local script?

Asked by
Kaput_0 44
5 years ago

so im trying to make a developer console for beta testing but I only want it to show up for specific people but the script won't change the visibility property at all, how do I fix this?

this is the script itself:

local whitelist = {"example1","example2",}
local player = game.Players.LocalPlayer

game.StarterGui.ScreenGui.conactive.Visible = false

print ("working")

game.Players.PlayerAdded:Connect(function()
    if player.Name == whitelist then

    end
end)

0
removed my answer. hes not willing to learn anything EmbeddedHorror 299 — 5y
0
again you dident need to i was just confused Kaput_0 44 — 5y
0
i would highly suggest making a serversided player detection using UserId and not the name of the player with it being local sided any simple exploiter could just make it visible themselves and without using UserId if the player ever changes their name then you have to change it too in the script Donut792 216 — 5y
0
this is for my singleplayer games, i only have it do this so that the normal player doesent think its a feature and gets overwhelmed, plus its hard to find it if your not looking for it and honestly if an exploiter is going to devalue their experience than that is on them Kaput_0 44 — 5y

3 answers

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago
local whitelist = {"example1","example2",}
local player = game.Players.LocalPlayer

player.PlayerGui.ScreenGui.conactive.Visible = false

print ("working")

game.Players.PlayerAdded:Connect(function()
    local found_flag = false
    for i,v in pairs(whitelist) do
        if player.Name==v then
            found_flag=true
        end
    end
    if found_flag then
    -- Make the visibility bool true
    end
end)


0
best answer here... ignore the other ones. EmbeddedHorror 299 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

cough StArTeRgUi good luck getting players guis from startergui. Its supposed to be PlayerGui. Mark a answer as answered so others will see the solution for their problem!

Log in to vote
-1
Answered by 5 years ago
Edited 5 years ago

If you are trying to access the local player's GUI with a player variable, you should use:

player.PlayerGui.ScreenGui.conactive.Visible = false

Trying to control the GUI listed in StarterGui won't do anything. The final script you are looking for is:

local whitelist = {"example1","example2",}
local player = game.Players.LocalPlayer

player.PlayerGui.ScreenGui.conactive.Visible = false

print ("working")

game.Players.PlayerAdded:Connect(function()
    if player.Name == whitelist then
    -- Make the visibility bool true
    end
end)

1
there's no way this works.... how can player.Name = a table of values? JasonTheOwner 391 — 5y

Answer this question