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

Value does not exist?

Asked by 7 years ago
Edited 7 years ago

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)

2 answers

Log in to vote
0
Answered by
Uroxus 350 Moderation Voter
7 years ago

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!

0
This error came up: attempt to index field 'Value' (a Boolean value) RobskiT 5 — 7y
0
What is the ServerLock instance in workspace? IntValue, StringValue, BoolValue??? Uroxus 350 — 7y
0
BoolValue RobskiT 5 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

Changed it to a string value and it now works, not gonna use BoolValue again

Answer this question