Multiplier disabling problems

this script is meant to disable other multipliers when the player enables one of them. instead of doing this, the multipliers go in sync (eg. when I disable them, the other one enables.) is there anything I can do to fix this?

localscript:

local button = script.Parent
local event = game.ReplicatedStorage.events.multiplierchange
local bool = script.Parent.Parent.Parent.multenabled.multenabled2x

fired = true

bool:GetPropertyChangedSignal("Value"):Connect(function()
	if bool.Value == false then
		
		fired = false
		local clicks = game.Players.LocalPlayer.leaderstats.Clicks
		local mval = 1
		local cost = 0
		local prod = script.prod.Value

		bool.Value = false

		event:FireServer(mval,cost,prod) --(multiplier value, cost, product)
		button.Text = "purchased! (disabled)"
		print(bool.Value, "2x")
		
	elseif bool.Value == true then
		
		fired = true
		local clicks = game.Players.LocalPlayer.leaderstats.Clicks
		local mval = 2
		local cost = 0
		local prod = script.prod.Value

		bool.Value = true

		event:FireServer(mval,cost,prod) --(multiplier value, cost, product)

		button.Text = "purchased! (enabled)"
		print(bool.Value, "2x")
		
	end
	
end)

button.MouseButton1Down:Connect(function()
	if fired == false then
		for _, enab in ipairs(script.Parent.Parent.Parent.multenabled:GetChildren()) do
			if enab.Value == true then
				enab.Value = false
			end
		end
		fired = true
		local clicks = game.Players.LocalPlayer.leaderstats.Clicks
		local mval = 2
		local cost = 0
		local prod = script.prod.Value

		bool.Value = true

		event:FireServer(mval,cost,prod) --(multiplier value, cost, product)

		button.Text = "purchased! (enabled)"
		print(bool.Value, "2x")
	else
		fired = false
		local clicks = game.Players.LocalPlayer.leaderstats.Clicks
		local mval = 1
		local cost = 0
		local prod = script.prod.Value

		bool.Value = false

		event:FireServer(mval,cost,prod) --(multiplier value, cost, product)
		button.Text = "purchased! (disabled)"
		print(bool.Value, "2x")
	end

end)

serverscript:

local mulchange = game.ReplicatedStorage.events.multiplierchange
local successev = game.ReplicatedStorage.events.successpurchase

mulchange.OnServerEvent:Connect(function(plr,mval,cost,prod) --(player, multiplier value, multiplier cost, product)
	local mintval = game.Players[plr.Name].Multiplier --multiplier int value
	mintval.Value = mval
	
	local cintval = game.Players[plr.Name].leaderstats.Clicks -- clicks int value
	cintval.Value = cintval.Value - cost
	
	local product = cintval
	
	successev:FireClient(plr,cost,prod)
end)

thanks for any help!

I have 2 more local scripts and one more server script, ask me if you need them!

1 Like

from what i can tell when you click the button you are running a function that is firing the server to change the value which causes the other function to run because the propertychangedsingal will fire from chaning the value you tried to stop this by checking if bool == false but you are setting bool = true after you are changing the value so the other code starts running before you set the bool to block it from running

is it ok if I ask for a modified version of the script to see what you mean?

ok bro thats legit rule 1 of the dev forum not to ask for written scripts. From what he told you can solve it yourself

this also looks straight from a tutorial