Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I keep getting a boolen value after an event and the value "happen" changes?

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

0

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

1 answer

✓ Accepted answer

Need to access the value of happen.

You've done the same thing multiple times throughout the script, you'll need to fix those as well.

        happen.Value = false

10 comments

0

well why is the problem here if happen.Value == true and acevent.Value == true then, even tho it says happen.Value

0

is game.ReplicatedStorage.happen a boolean value?

0

yes

0

local acevent = game.ReplicatedStorage.caevent - this is your variable, but i see the name of the bool and the variable name are different, confirm the reference is correct.

0

I dont see any further issues with the line, unless you've made a naming mistake.

0

wdym, also can we chat in the website chat so we dont have to keep refreshing

0

Confirm that you've named everything correctly, make sure the variables(references) match EXACTLY what the booleans are in replicated storage. Theres no reason why this wouldn't work otherwise.

0

yes they are correct because, you can run the first event perfectly fine and the next it dosesn't and says boolean value doesent work

0

Did you correct all the happen = true? The first call of acevent is on line 16, thats why im asking.

0

Ok i did that and it dosent give me error now but, now after happen = true, it makes all server events happen at once

This discussion is preserved as it was. New answers, comments, and votes are closed.