Hello, so i've encountered a problem. Whenever someone rebirths, the cost for the rebirth also goes up for other people. excuse me for bad scripting, I am quite new

local RebirthRequiredCostRebirth1 = 100
local RebirthRequiredCostRebirth4 = 350
local right = 1+1
local answer = 2



script.Rebirth1.OnServerEvent:Connect(function(plr)

		local leaderstats = plr:WaitForChild("leaderstats")
		local Rebirth = plr:WaitForChild("leaderstats").Rebirth	
		local CostMult = Rebirth.Value
		local RebirthButton1 = plr:WaitForChild("PlayerGui").MainGui.RebirthFrame.Rebirth1
		local RebirthButton4 = plr:WaitForChild("PlayerGui").MainGui.RebirthFrame.Rebirth4
		if leaderstats.Click.Value >= RebirthRequiredCostRebirth1 then
		leaderstats.Rebirth.Value = leaderstats.Rebirth.Value + 1
		leaderstats.Click.Value = 0
		RebirthRequiredCostRebirth1 = RebirthRequiredCostRebirth1 + (Rebirth.Value + 50)
		RebirthRequiredCostRebirth4 = RebirthRequiredCostRebirth4 + (Rebirth.Value + 200)
		RebirthButton1.TextLabel.Text = "1 Rebirth: ".. tostring(RebirthRequiredCostRebirth1) .." Clicks"
		RebirthButton4.TextLabel.Text = "4 Rebirth: ".. tostring(RebirthRequiredCostRebirth4) .." Clicks"
		end
	end)
script.Rebirth4.OnServerEvent:Connect(function(plr)
	local leaderstats = plr:WaitForChild("leaderstats")
	local Rebirth = plr:WaitForChild("leaderstats").Rebirth	
	local CostMult = Rebirth.Value
	local RebirthButton1 = plr:WaitForChild("PlayerGui").MainGui.RebirthFrame.Rebirth1
	local RebirthButton4 = plr:WaitForChild("PlayerGui").MainGui.RebirthFrame.Rebirth4
	if leaderstats.Click.Value >= RebirthRequiredCostRebirth4 then
	leaderstats.Rebirth.Value = leaderstats.Rebirth.Value + 4
	leaderstats.Click.Value = 0
	RebirthRequiredCostRebirth1 = RebirthRequiredCostRebirth1 + (Rebirth.Value + 50)
	RebirthRequiredCostRebirth4 = RebirthRequiredCostRebirth4 + (Rebirth.Value + 200)
	RebirthButton1.TextLabel.Text = "1 Rebirth: ".. tostring(RebirthRequiredCostRebirth1) .." Clicks"
	RebirthButton4.TextLabel.Text = "4 Rebirth: ".. tostring(RebirthRequiredCostRebirth4) .." Clicks"
end
end)




1 comment

0

I Think Its Because You Are Using A Event Meaning It Is Going To Fire To ALL Players But If You Had Sent Data Through The Event To Get The Player Then IDK