My script will run and the first part will work changing tvalue but for some reason after that when i make happen = true after that it makes it true but then the happen.Changed function doesent activate, I have no idea why.
I put a print under the changed function and I got no print, so the problem is the Changed Function not working in the beginning
local vipid = 5785777
local Players = game:GetService("Players")
local ews = game.Workspace.EventModel
local efolder = game.Lighting.EventModels
local evalues = game.ReplicatedStorage.EventValues
local tvalue = game.ReplicatedStorage.Values.tvalue
local aevent = game.ReplicatedStorage.Values.aevent
local acevent = game.ReplicatedStorage.Values.caevent
local happen = game.ReplicatedStorage.Values.happen
local aname = game.ReplicatedStorage.Values.ename
local money = game.ReplicatedStorage.Values.money
local events = {"FloorIsLava","Event","BlackHole"}
tvalue.Value = 5 --------------------------- PROBLEM STARTS HERE
wait(1)
tvalue.Value = 4
wait(1)
tvalue.Value = 3
wait(1)
tvalue.Value = 2
wait(1)
tvalue.Value = 1
wait(1)
happen.Value = true
wait()
happen.Changed:Connect(function()
local apick = math.random(1,3)
if happen.Value == true and acevent.Value == true then
happen.Value = false
if aevent.Value == "FloorIsLava" then
aname.Value = "FloorIsLava"
aevent.Value = ""
acevent.Value = false
wait()
print("AFloorIsLava")
local fur = efolder.FloorIsLava.Furniture
local lava = efolder.FloorIsLava.Lava
fur.Parent = ews
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
lava.Parent = ews
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
lava.Parent = efolder.FloorIsLava
fur.Parent = efolder.FloorIsLava
for i, player in pairs(Players:GetPlayers()) do
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,vipid) then
player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50 + 20
else player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50
end
end
aname.Value = "Intermission"
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)
happen.Value = true
elseif aevent.Value == "BlackHole" then
aevent.Value = ""
aname.Value = "BlackHole"
acevent.Value = false
wait()
print("BlackHole")
happen.Value = false
game.Workspace.Map.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
end
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.Map.Ground.Velocity = Vector3.new(0,0,0)
for i, player in pairs(Players:GetPlayers()) do
player.Character.Humanoid.PlatformStand = false
aname.Value = "Intermission"
for i, player in pairs(Players:GetPlayers()) do
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,vipid) then
player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50 + 20
else player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50
end
aname.Value = "Intermission"
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)
happen.Value = true
end
end
end
elseif happen.Value == true and acevent.Value == false then
if apick == 1 then
aevent.Value = ""
aname.Value = "BlackHole"
acevent.Value = false
wait()
print("BlackHole")
happen.Value = false
game.Workspace.Map.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
end
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.Map.Ground.Velocity = Vector3.new(0,0,0)
for i, player in pairs(Players:GetPlayers()) do
player.Character.Humanoid.PlatformStand = false
aname.Value = "Intermission"
end
for i, player in pairs(Players:GetPlayers()) do
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,vipid) then
player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50 + 20
else player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50
end
end
aname.Value = "Intermission"
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)
happen.Value = true
elseif apick == 2 then
happen.Value = false
aname.Value = "FloorIsLava"
print("FloorIsLava")
print("AFloorIsLava")
local fur = efolder.FloorIsLava.Furniture
local lava = efolder.FloorIsLava.Lava
fur.Parent = ews
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
lava.Parent = ews
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
lava.Parent = efolder.FloorIsLava
fur.Parent = efolder.FloorIsLava
for i, player in pairs(Players:GetPlayers()) do
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,vipid) then
player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50 + 20
else player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50
end
end
aname.Value = "Intermission"
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)
happen.Value = true
elseif apick == 3 then
happen.Value = false
aname.Value = "event3"
print("event3")
for i, player in pairs(Players:GetPlayers()) do
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId,vipid) then
player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50 + 20
else player.leaderstats.Events.Value = player.leaderstats.Events.Value + 1
player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 50
end
end
aname.Value = "Intermission"
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)
happen.Value = true
aname.Value = "Intermission"
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)
happen.Value = true
end
end
end)

6 comments
Your script requires that both acevent and happen are true, not just happen, check that acevent is true at the same time
There is a spot for that... elseif happen.Value == true and acevent.Value == false then... Also as i stated if i put a print under the changed, It dosent print
I'd recommend learning how to use for loops.
Are you sure that "Changed" is a valid event of "happen", since it should at least print if it is
Yes, as if i change it manually it works
Good lord... if that isn't spaghetti code then I don't know what is.