:GetPropertyChangedSignal doesnt working

I want to change the last slot with slot1 and slot2 value. I dont want to use while wait() do because I want something more clean I tried to use :GetPropertyChangedSignal but is not working.

image
This is the board. Before I tried to use while wait() do it works but I want to use :GetPropertyChangedSignal on it

local Board = script.Parent
local Slots = Board.Slots
local Buttons = Board.Buttons

local slot1 = Slots.Slot1
local slot2 = Slots.Slot2
local resultSlot = Slots.ResultSlot

local slot1Add = Buttons.Slot1Add
local slot1Remove = Buttons.Slot1Remove
local slot2Add = Buttons.Slot2Add
local slot2Remove = Buttons.Slot2Remove

local mathSlot = Buttons.MathSlot
local additionButton = Buttons.AdditionButton
local subtractionButton = Buttons.SubtractionButton
local divisionButton = Buttons.DivisionButton
local multiplicationButton = Buttons.MultiplicationButton

local slot1Value = slot1.Slot1Value
local slot2Value = slot2.Slot2Value
local resultValue = resultSlot.ResultSlotValue
local mathValue = mathSlot.SlotValue

local slot1Text = slot1.SurfaceGui.TextLabel
local slot2Text = slot2.SurfaceGui.TextLabel
local resultText = resultSlot.SurfaceGui.TextLabel
local mathText = mathSlot.SurfaceGui.TextLabel

--------------- Adding/Removing --------------------
slot1Add.ClickDetector.MouseClick:Connect(function()
	slot1Value.Value = slot1.Slot1Value.Value + 1
	slot1Text.Text = slot1Value.Value
end)

slot1Remove.ClickDetector.MouseClick:Connect(function()
	slot1Value.Value = slot1.Slot1Value.Value - 1
	slot1Text.Text = slot1Value.Value
end)

slot2Add.ClickDetector.MouseClick:Connect(function()
	slot2Value.Value = slot2.Slot2Value.Value + 1
	slot2Text.Text = slot2Value.Value
end)

slot2Remove.ClickDetector.MouseClick:Connect(function()
	slot2Value.Value = slot2.Slot2Value.Value - 1
	slot2Text.Text = slot2Value.Value
end)

additionButton.ClickDetector.MouseClick:Connect(function()
	mathValue.Value = 0
	mathText.Text = "+"
end)

subtractionButton.ClickDetector.MouseClick:Connect(function()
	mathValue.Value = 1
	mathText.Text = "-"
end)

divisionButton.ClickDetector.MouseClick:Connect(function()
	mathValue.Value = 2
	mathText.Text = ":"
end)

multiplicationButton.ClickDetector.MouseClick:Connect(function()
	mathValue.Value = 3
	mathText.Text = "X"
end)
----------------------------------------------------------

resultValue:GetPropertyChangedSignal("Value"):Connect(function(change)
	resultText.Text = resultValue.Value
	if mathValue.Value == 0 then
		resultValue.Value = slot1Value.Value + slot2Value.Value
		
	elseif mathValue.Value == 1 then
		resultValue.Value = slot1Value.Value - slot2Value.Value
		
	elseif mathValue.Value == 2 then
		resultValue.Value = slot1Value.Value / slot2Value.Value
		
	elseif mathValue.Value == 3 then
		resultValue.Value = slot1Value.Value * slot2Value.Value
	end
	change:Desconnect()
end)
1 Like

Do you get any errors saying “ResultSlotValue” is not a member of “resultSlot”?

no I dont get nothing on output

What kind of instance is “ResultSlotValue”? Is it a StringValue etc?

all values are IntValues maybe that is the issue?

Last question, where is the Value Placed? ReplicatedStorage?

the value is inside the result slot I will send you wait

image

When I looked at your code once again, I can’t see value of resultValue changing anywhere in the code, that must be the reason why :GetPropertyChangedSignal for Value never fires.

You are changing value of resultValue inside the GetPropertyChangedSignal function which never fires since the value is never changed!

Change it to Disconnect()

Is it the right value?

yes the value is that (last slot)

resultValue changes. when you click in “+” or “-” you change the slot1 value and slot2 value and that change the resultValue

Where is resultValue being changed in any of these?

I think I forget about that… maybe I should use the mathValue?

Using the mathValue, you can find the result of the addition/subtraction/multiplication/division of the two numbers and change the value of resultValue using a script, and that will fire GetPropertyChangedSignal for resultValue!

So I have to use one new value for change the resultValue.

No,

When setting these values, use their symbols to carry out the arithmetic operations on the two numbers in slot1 and slot2 and when you have the result of the operation, change the value of resultValue. That will do it.

1 Like

additionButton.ClickDetector.MouseClick:Connect(function()

mathValue.Value = 0

mathText.Text = “+”

resultValue.Value = slot1Value.Value + slot2Value.Value

resultText.Text = resultValue.Value

end)

subtractionButton.ClickDetector.MouseClick:Connect(function()

mathValue.Value = 1

mathText.Text = “-”

resultValue.Value = slot1Value.Value - slot2Value.Value

resultText.Text = resultValue.Value

end)

divisionButton.ClickDetector.MouseClick:Connect(function()

mathValue.Value = 2

resultValue.Value = slot1Value.Value / slot2Value.Value

resultText.Text = resultValue.Value

end)

multiplicationButton.ClickDetector.MouseClick:Connect(function()

mathValue.Value = 3

mathText.Text = “X”

resultValue.Value = slot1Value.Value * slot2Value.Value

resultText.Text = resultValue.Value

end)

The problem is I want it keep changing. (dont have to click on the buttons for change the last slot)

I was using while wait() do but I dont want to make that type of loop

This is basicly what happens