So, I am making a "Dev Lair", were us devs can reuse assets, control weather, etc. (I don't wanna do this via GUI). BUT, it's hidden, like so.
I am using an invisible part to either let people in or kick people. It also has a Lock feature, where I may choose to not let other devs in, either.
My code is simple and basic for any experienced dev, so here we go:
local locked = script.Parent.Locked -- A "Bool Value" ----------------------------------------------------------------------------------- script.parent.touched:Connect(function(t) local plr = game.Players:GetPlayerFromCharacter(t.Parent) local rank =plr:GetRankInGroup(3326074) if rank >= 19 and locked.Value == false then script.Parent.CanCollide = false elseif rank >= 19 then plr:Kick("THIS HAS BEEN LOCKED BY SOME OTHER DEV (or hacker)! HA!") else plr:Kick("YOU MAY NOT ENTER THE HOLY DEVELOPER'S LAR, NOOB!!! HA HA HA HA HA HA HA HA HA HA HA!!!") end end) ---------------------------------------------------------------------------------- script.Parent.TouchEnded:Connect(function() script.Parent.CanCollide = true end)
"Locked" is a Bool Value
, if you couldn't tell.
Now, if we move to the Output log, things get VERY confusing indeed...
17:14:00.903 - Workspace.Terrain.DevLair.KickWall.Script:10: attempt to index upvalue 'locked' (a boolean value)
17:14:00.904 - Stack Begin
17:14:00.904 - Script 'Workspace.Terrain.DevLair.KickWall.Script', Line 10
17:14:00.905 - Stack End
So, I ask: " WHAT IS AN "upvalue???! "
And, also, can somebody please help me figure out how to fix this? Thanks in advance!
Rename your BoolValue
to something else. The script is thinking you are using the Locked
Property of parts.
It is erroring because you are checking if a Boolean
has a Value
where you need to check if a BoolValue
has a Value
.
--error local x = true --because Part.Locked is a bool property print(x.Value) --success local x = Instance.new('BoolValue') print(x.Value)