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!