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

My GUI Loading Screen is not working and I dont know what the problem is?

Asked by 5 years ago

So I am trying to make a GUI script where on join you get a GUI, in order to Click the Button to let the GUI disappear you need to have permission. But I think I am doing something wrong in my script.(LocalScript) Can anyone take a look into my script and see what is wrong?

gui = script.Parent
Button = gui.TextButton
BigText = gui.BigText
Note = gui.Note
NoAcces = gui.NoAccess
gui.Visible = true
gui.NoAccess.Visible = false


Access = {["maup12345"] = true,["TristyOfficial"] = true}
function OnClicked()
    if Access["maup12345"] == true and Access["TristyOfficial"] == true then
        gui.Visible = false
    elseif Access["maup12345"] == false and Access["TristyOfficial"] == false then
        gui.Visible = true
        gui.NoAccess.Visible = true
        wait(3)
        gui.NoAccess.Visible = false
    end
end

script.Parent.TextButton.MouseButton1Click:Connect(OnClicked)

2 answers

Log in to vote
0
Answered by
CPF2 406 Moderation Voter
5 years ago
gui = script.Parent
Button = gui.TextButton
BigText = gui.BigText
Note = gui.Note
NoAcces = gui.NoAccess
gui.Visible = true
gui.NoAccess.Visible = false


Access = {["maup12345"] = true,["TristyOfficial"] = true}

function OnClicked()
    if Access[game.Players.LocalPlayer.Name] ~= nil then
        gui.Visible = false
    else
        gui.Visible = true
        gui.NoAccess.Visible = true
        wait(3)
        gui.NoAccess.Visible = false
    end
end

script.Parent.TextButton.MouseButton1Click:Connect(OnClicked)

This should work, I believe the reason it wasn't working before was because in your if statement you were checking if ['maup12345'] and ['TristyOfficial'] were true, (which obviously they would be because you just set them as true in the table) which would cause the gui to always not show.

Ad
Log in to vote
0
Answered by 5 years ago

Thank you!

Just one more thing, I tried figuring out how to kick the local player who does not have access to the game but couldnt figure it out. How do I kick the local player who pressed the Button if he does not have access?

0
Use the Kick function of the player Rare_tendo 3000 — 5y
0
do you chex said, ex. game.Players.LocalPlayer:Kick() CPF2 406 — 5y

Answer this question