local Music = game:GetService("SoundService")
local Neutral = Music.Neutral
local FirstTrumpet = Music.FirstTrumpet
local SecondTrumpet = Music.SecondTrumpet
local ThirdTrumpet = Music.ThirdTrumpet
local RiskLevel = game.ReplicatedStorage.Variables.TotalRiskLevel.Value
local AbnosBreached = game.ReplicatedStorage.Variables.AbnosBreached.Value --ts will probably go unused honestly
local CurrentTrack = nil
local function ManageMusic()
if CurrentTrack ~= nil then
CurrentTrack:Stop()
end
if RiskLevel == 0 then
CurrentTrack = Neutral
elseif RiskLevel > 1 and RiskLevel < 5 then
CurrentTrack = FirstTrumpet
elseif RiskLevel > 5 and RiskLevel < 10 then
CurrentTrack = SecondTrumpet
elseif RiskLevel >= 10 then
CurrentTrack = ThirdTrumpet
end
print(CurrentTrack.Name)
CurrentTrack.Looped = true
CurrentTrack:Play()
end
ManageMusic()
game.ReplicatedStorage.Variables.TotalRiskLevel.Changed:Connect(ManageMusic)```
#greater than symbols not processing properly or something idk
1 messages · Page 1 of 1 (latest)
So just to make sure, the problem is that the script should be printing FirstTrumpet instead of Neutral when the risk level is equal to 2?
yeah
ok so I've realized everything mathmatically works fine
Are you updating the risk level value throughout the game? and is the total risk level default value set to 0?
yes EVERYTHING works perfectly but changing the CurrentTrack thing
oh wait
hold on
nope nvm
see it's changing
it's running the function again
but the current track isn't changing
Then it could be a problem with how you are getting the risk level value, in your script you are setting RiskLevel equal to the value of the TotalRiskLevel object, so you are setting the variable equal to what the value is at that time, not what it is at all times
essentially the variable is stuck at 0
it shouldn't be, I've verified that the variable is infact changing
yes but is the variable itself changing
Just use studio assisinat to fix the code
bruh
I mean its and idea
I mean it prob could but ai can be mega unreliable in debugging, plus if someone human knows the exact problem its uneeded
local Music = game:GetService("SoundService")
local Neutral = Music.Neutral
local FirstTrumpet = Music.FirstTrumpet
local SecondTrumpet = Music.SecondTrumpet
local ThirdTrumpet = Music.ThirdTrumpet
local RiskLevel = game.ReplicatedStorage.Variables.TotalRiskLevel
local AbnosBreached = game.ReplicatedStorage.Variables.AbnosBreached --ts will probably go unused honestly
local CurrentTrack = nil
local function ManageMusic()
if CurrentTrack ~= nil then
CurrentTrack:Stop()
local CurrentTrack = nil
end
if RiskLevel == 0 then
CurrentTrack = Neutral
elseif RiskLevel.Value > 1 and RiskLevel.Value < 5 then
CurrentTrack = FirstTrumpet
elseif RiskLevel.Value > 5 and RiskLevel.Value < 10 then
CurrentTrack = SecondTrumpet
elseif RiskLevel.Value >= 10 then
CurrentTrack = ThirdTrumpet
end
print(CurrentTrack.Name)
CurrentTrack.Looped = true
CurrentTrack:Play()
end
ManageMusic()
game.ReplicatedStorage.Variables.TotalRiskLevel.Changed:Connect(ManageMusic)```
this works
He could try
the local variable was always set to a constant value like you said
Nice, but one more thing
Is your risk value ever 1 or 5, im worried your script doesnt account for those values
btw guys is there a animation plugin like moon animator but for free?
for example you are checking if the value is 0, or greater than 1, but never if its 1 istself
oh right hold on I forgot to fix that
Im good at Animations but roblox animation editor sucks
ok yeah this should work
I dont think so, but Ive seen some people prefer blender for animations, but I would ask elsewhere, like #🏃︱animating