I can’t se the UI
I used something easy to make so i did make this what needs to pop up if it worked
I can’t se the UI
I used something easy to make so i did make this what needs to pop up if it worked
Are any errors popping up in Output (Find that in the same area where you enable explorer)?
If we can’t get it working i will only use the first script where it will just kick you
Forgive my stupidity, functions need a bracket on an end to tell the code to end a function, not a regular conditional statement or something.
Just simply add a close bracket )
at the last end (on line 16)
local ServerLocked = script.ServerLocked
local WhiteList = {"TurteleDJ", "GreenTxrtIe", "NotKxng"} --remember to replace with UserIds!!
game:GetService("Players").PlayerAdded:Connect(function(plr)
local ServerLockUI = plr:WaitForChild("PlayerGui").ServerIsLocked
if ServerLocked.Value == true then
if table.find(WhiteList, plr.Name) then
print("Owner did join the game")
return end
else
local ServerLockUI = plr:WaitForChild("PlayerGui")
ServerLockUI.ServerIsLocked.Enabled = true -- the problem needs to be here
wait(100)
plr:Kick("You are not allowed to join the game only game devs can join the game this game is in test proces")
end
end)
Bruh now it is fixed do i need to add a wait before running the script or something cause now it can’t find the UI
ServerIsLocked
is parented to StarterGui
local ServerLockUI = plr:WaitForChild("PlayerGui").ServerIsLocked
to
local ServerLockUI = plr:WaitForChild("PlayerGui"):WaitForChild("ServerIsLocked")
There is a teeny possible chance the gui didn’t replicate to the player fast enough and the server ran the code first.
Ref reply below:
Do plr.UserId
otherwise it won’t work
I did change it to player id’s cause it’s better right
local ServerLocked = script.ServerLocked
local WhiteList = {590367685} --remember to replace with UserIds!!
game:GetService("Players").PlayerAdded:Connect(function(plr)
local ServerLockUI = plr:WaitForChild("PlayerGui").ServerIsLocked
if ServerLocked.Value == true then
if table.find(WhiteList, plr.Userid) then
print("Owner did join the game")
return end
else
local ServerLockUI = plr:WaitForChild("PlayerGui")
ServerLockUI.ServerIsLocked.Enabled = true -- the problem needs to be here
wait(100)
plr:Kick("You are not allowed to join the game only game devs can join the game this game is in test proces")
end
end)
Fixed your code:
local ServerLocked = script.ServerLocked
local WhiteList = {590367685} --remember to replace with UserIds!!
game:GetService("Players").PlayerAdded:Connect(function(plr)
local ServerLockUI = plr:WaitForChild("PlayerGui"):WaitForChild("ServerIsLocked")
if ServerLocked.Value == true then
if table.find(WhiteList, plr.UserId) then
print("Owner did join the game")
return end
else
ServerLockUI.Enabled = true -- the problem needs to be here
wait(100)
plr:Kick("You are not allowed to join the game only game devs can join the game this game is in test proces")
end
end)
I did it but now it is still saying the same error but the UI is still in the startergui and not enabled is that the problem maybe?
The script does not give me any errors but now it is only not showning up
cause it is still disabled
Could you show me your code that you’re currently using? I think you’ve mixed up and used the wrong code I gave you? It shouldn’t be erroring if your Gui replicates to the player successfully before your code runs
Code that should be working (?)
local ServerLocked = script.ServerLocked
local WhiteList = {590367685} --remember to replace with UserIds!!
game:GetService("Players").PlayerAdded:Connect(function(plr)
local ServerLockUI = plr:WaitForChild("PlayerGui"):WaitForChild("ServerIsLocked")
if ServerLocked.Value == true then
if table.find(WhiteList, plr.UserId) then
print("Owner did join the game")
return end
else
ServerLockUI.Enabled = true -- the problem needs to be here
wait(100)
plr:Kick("You are not allowed to join the game only game devs can join the game this game is in test proces")
end
end)
Otherwise, I’m really confused why it’s erroring at line 5.
local ServerLocked = script.ServerLocked
local WhiteList = {} --remember to replace with UserIds!!
game:GetService("Players").PlayerAdded:Connect(function(plr)
local ServerLockUI = plr:WaitForChild("PlayerGui"):WaitForChild("ServerIsLocked")
if ServerLocked.Value == true then
if table.find(WhiteList, plr.UserId) then
print("Owner did join the game")
return end
else
ServerLockUI.ServerIsLocked.Enabled = true -- the problem needs to be here
wait(100)
plr:Kick("You are not allowed to join the game only game devs can join the game this game is in test proces")
end
end)
Ah, now I see the issue again. You’ve accidentally repeated a mistake.
Line 11 ServerLockUI.ServerIsLocked.Enabled = true
You need to remove ServerIsLocked as it’s already defined in the variable.
Change it to ServerLockUI.Enabled = True
.
Question: why aren’t you just using game access permissions? You wouldn’t need any code at all. Game access permissions supports whitelisting users for play access, meaning that users who aren’t cleared wouldn’t be able to join the game at all (play button on the website gets removed).
You will need to turn on Team Create to access collaboration permissions. If you have a group game you can create a tester access rank, ask your whitelisted folks to join the group and then rank them up there, then grant that role play permissions. If you have the game on your profile, the same process is pretty much applicable.
I’ll show you the steps as pictures if you need help understanding what I’m saying. This outlines how to add testers to your game without code from a game on your profile. Again, groups may have a slightly different process, but a recent update should allow you to add players too.
1. Ensure team create is on.
2. Go to permissions. Make sure your game is private.
3. Invite a user (or a group).
4. Save your changes. These people can now play your game, but anyone who doesn’t have a permission assigned to them in this window will not. No code. You’re all set.
I may be misunderstanding your question because it seems to have changed since you posted. I can’t tell if you’re making a server locking system with a whitelist or just a hard whitelist. If you’re making server locking, then this isn’t for you. If you’re making closed access testing, this is for you.
I was making this code cause i wanted to have the game still visible in my group cause i need to set it private for that and go to
roblox.com>Create>groupCreations>clickmygame>then join
if i don’t i can just join it by pressing the group>press the game>and play
that’s basicly why i’m doing this and also for learning some more stuff about tables and stuff cause idk but i can’t really figure out how tables are working
From the scrip you posted it looked like you were trying to do server locking. If that isn’t the case use @colbert2677’s solution above.
Are you sure you removed that wait() for testing purposes? I can’t imagine you constantly waiting 100 seconds to test each code. If you (for some reason?) need to actually wait 100 seconds are you sure you’ve waited 100 seconds?
ye but it is not working i think i’m just going with the previous code without the UI cause this is basicly spending time for nothing cause it is not working at all and i don’t really want to spend an 1h to make this UI just work.
Is there a reason why you need the game visible in the group? You can always link the game in your group’s description or privately to the people who you want playing. You can also favourite it to bookmark it on your profile. It’s a much crisper and easy-to-use solution than trying to tear your hair out with this code just to keep it visible on the game list.
I’m not sure I even fully understand where your point of frustration is coming from, your script doesn’t seem incorrect. Where are you running it from? Hopefully you aren’t running a server script in a PlayerGui, can’t see where it is in the above pictures. I’m lost at what your current issues are.