The value returns a nil value, even though it is there.
The script is in a model in a workspace
Model -Script -ServerLock (Variable already set to true) -off (Button to modify the variable when clicked) -on (Button to modify the variable when clicked)
The variable is there because it should be able to be adjusted in game.
local Admins = {'Builderman','KZskychi'} local BanMessage = 'There is currently no flight on at present time or the server has been locked by an admin. Please check the group shout for flight times.' game.Players.PlayerAdded:connect(function(player) for i = 1, #Admins do if script.Parent.ServerLock.Value == true then if player.Name == Admins[i] then else player:Destroy() player:Kick(BanMessage) end end end end)
Although I've not actually tested this by the looks of it the error is on line 8 if script.Parent.ServerLock.Value == true then
You're only selecting the property called Value
rather than what the value actually is within that property.
To fix this you'd want to change it to
if script.Parent.ServerLock.Value.Value == true then
If this answered your question accept my answer with the button on the right, if it doesn't work please tell me and if you'd like a better explanation please let me know!
Changed it to a string value and it now works, not gonna use BoolValue again