How to get a chance ever day cycle Math.Random

so basically i want it if it becomes Night it checks and gets a new chance every night

so one night it could be 1 and the next it could be 2< pretty hard to understand

local lighting = game:GetService("Lighting")
local ts = game:GetService("TweenService")
local transition = 15
local ti = TweenInfo.new(transition,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut)
local Morning = ts:Create(lighting,ti,{ClockTime = 14})
local Night = ts:Create(lighting,ti,{ClockTime = 0})
local TweenS = game:GetService("TweenService")
local Lighting = game.Lighting
local BloodHourChance = math.random(1,5)
local TweenInf = TweenInfo.new(5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out, 0, false, 0)

local Finish = {FogColor=Color3.new(0.611765, 0.572549, 0.490196)}
local Nights = {FogColor=Color3.new(0, 0, 0)}

local FogTween = TweenS:Create(Lighting, TweenInf, Nights)
local FogMorning = TweenS:Create(Lighting, TweenInf, Finish)
while true do wait()
	
	local BloodHourChance = math.random(1,5)
	print(BloodHourChance)
	game.Workspace.The_Rake.Parent = game.ServerStorage
	game.Workspace.Ambient:Stop()
	game.Lighting.FogEnd = 190
	game.Workspace.DayTimeSong:Play()
	Morning:Play()
	wait(5)
	game.ReplicatedStorage.CheckPlayer:FireAllClients()
	FogMorning:Play()
	
	
	
	wait(210)
	


	game.Workspace.NightTime:Play()
	Night:Play()
	wait(5)
	game.Workspace.Ambient:Play()
	FogTween:Play()
	game.Lighting.FogEnd = 50
	wait(5)
	game.ReplicatedStorage.Night:FireAllClients()
game.Lighting.Brightness = 1
	game.ServerScriptService.Fix.Disabled = false
	
	game.Workspace.Vibrate.Disabled = false
	wait(5)
	game.Workspace.Vibrate.Disabled = true
	game.ServerScriptService.Fix.Disabled = true
	game.ServerStorage.The_Rake.Parent = game.Workspace
	game.Workspace.RakeScream:Play()
	

	

	
	wait(140)
	
	if game.Workspace.The_Rake.Stun.GetStuns.Value == 10 or BloodHourChance == 1 then
		print("BloodHour Starting Bois")

end

end
1 Like

You put local BloodHourChance twice, once it is defined you no longer need to put local when you call it. If that does not work then make a function that returns a math random.

is this the logic you are looking for?

function getRandomValue(previousValue)

repeat

BloodHourChance = math.random(1,5)

until BloodHourChance ~= previousValue

return BloodHourChance

end

getRandomValue(1)

print(BloodHourChance)