Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

NumberValue.Changed:Connect() not firing. Why is this happening?

Asked by 3 years ago

I can't seem to get the NumberValue.Changed:Connect() to fire. It is necessary for this script to work. Any help?

print("Running!")
local mode = script.Parent.Mode
local armBands = script.Parent.ArmBands
local nameGui = script.Parent.NameGui
local music = Instance.new("Sound")
music.Name = "Music"
music.Parent = script.Parent:WaitForChild("HumanoidRootPart")
music.Looped = true

local function changeThemeColor(color)
    print("Changing Theme!")
    armBands.LeftArmBand.Glow.Color = color
    armBands.RightArmBand.Glow.Color = color
    nameGui.NameLabel.TextColor3 = color
end

local function changeName(newName)
    print("Changing Name!")
    nameGui.NameLabel.Text = newName
end

local function changeMusic(Id)
    if music.Playing then
        music:Stop()
    end
    music.SoundId = Id
    music:Play()
end

local function change()
    if mode.Value == 1 then
        changeName("Peace")
        changeThemeColor(Color3.new(0.968627, 0, 1))
        changeMusic("rbxassetid://3221578654")
    end
    if mode.Value == 2 then
        changeName("Purity")
        changeThemeColor(Color3.new(0, 1, 1))
        changeMusic("rbxassetid://2168518839")
    end
end

change()
wait(10)
mode.Value = 2

mode.Changed:Connect(function()
    print("Mode Changed!")
    change()
end)

0
ah yes, bool values, why does everyone have this problem that barely anyone can solve A_Mp5 222 — 3y
0
did you add a remote event to fire it? Heyvsaucethano 0 — 3y

Answer this question