After I do an admin event, aka aevent where I change the event for myself, so after I do an admin event or server event after that if the happen value gets changed I get the error
"attempt to index upvalue 'happen' a (boolean value)"
The error is happening on line 16 "if happen.Value == true and acevent.Value == true then" I have no idea why this is occuring.
wait(1)
local Players = game:GetService("Players")
local tvalue = game.ReplicatedStorage.tvalue
local aevent = game.ReplicatedStorage.aevent
local acevent = game.ReplicatedStorage.caevent
local happen = game.ReplicatedStorage.happen
local aname = game.ReplicatedStorage.ename
local events = {"Meteor","Event","BlackHole"}
happen.Changed:Connect(function()
local epick = math.random(1,3)
if happen.Value == true and acevent.Value == true then
happen = false
if aevent.Value == "Meteor" then
aname.Value = "Meteor"
aevent.Value = ""
acevent.Value = false
wait()
print("AMeteor")
happen = true
elseif aevent.Value == "BlackHole" then
aevent.Value = ""
aname.Value = "BlackHole"
acevent.Value = false
wait()
print("BlackHole")
happen = false
game.Workspace.Ground.Velocity = Vector3.new(30,0,0)
local bh = game.Lighting.EventModels.BlackHole
bh.Parent = game.Workspace.EventModel
for i, player in pairs(Players:GetPlayers()) do
player.Character.Humanoid.PlatformStand = true
tvalue.Value = 15
wait(1)
tvalue.Value = 14
wait(1)
tvalue.Value = 13
wait(1)
tvalue.Value = 12
wait(1)
tvalue.Value = 11
wait(1)
tvalue.Value = 10
wait(1)
tvalue.Value = 9
wait(1)
tvalue.Value = 8
wait(1)
tvalue.Value = 7
wait(1)
tvalue.Value = 6
wait(1)
tvalue.Value = 5
wait(1)
tvalue.Value = 4
wait(1)
tvalue.Value = 3
wait(1)
tvalue.Value = 2
wait(1)
tvalue.Value = 1
wait(1)
tvalue.Value = 0
bh.Parent = game.Lighting.EventModels
game.Workspace.Ground.Velocity = Vector3.new(0,0,0)
for i, player in pairs(Players:GetPlayers()) do
player.Character.Humanoid.PlatformStand = false
happen = true
end
end
elseif aevent.Value ~= events then
print("SpellingIncorrect")
aevent.Value = ""
acevent.Value = false
happen = true
wait(1)
happen = false
end
elseif happen.Value == true and acevent.Value == false then
if epick == 1 then
happen = false
aname.Value = "event1"
print("event1")
happen = true
elseif epick == 2 then
happen = false
aname.Value = "event2"
print("event2")
happen = true
elseif epick == 3 then
happen = false
aname.Value = "event3"
print("event3")
happen = true
elseif happen.Value == false then
print("stop")
end
end
end)

1 comment
I've made this mistake before a few times, its actually really silly, but DinozCreates is right, you need to make sure to write ".Value" after the variable so that it reads the value properly