local events = game:GetService("ReplicatedStorage").Events
local player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent
local amount = script.Parent.Amount.Value
local cost = script.Parent.Cost.Value
script.Parent.MouseButton1Click:Connect(function()
script.Parent.Cost.Value += 500
print(cost)
events.Rebirths:Fire(player, amount, cost)
end)
You need to be using a remote event, not a bindable event. And this should be a local script if not already. Or more appropriately probably a remote function so you can get something back from the server confirming the player had enough money to change the text.
This creates a local copy of script.Parent.Cost.Value, so now:
cost = 600
script.Parent.Cost.Value = 600
You change it here: script.Parent.Cost.Value += 500
Now the values are:
cost = 600
script.Parent.Cost.Value = 1100
You should reference the value again, not the copy of what it used to be, like: events.Rebirths:Fire(player, amount, script.Parent.Cost.Value)
Better yet, use a better reference:
local events = game:GetService("ReplicatedStorage").Events--be sure to wait for this child
local player = script.Parent.Parent.Parent.Parent.Parent.Parent.Parent--this is a really poor reference by the way
local amount = script.Parent.Amount
local cost = script.Parent.Cost
script.Parent.MouseButton1Click:Connect(function()
cost.Value += 500
print(cost.Value)
events.Rebirths:Fire(player, amount.Value, cost.Value)
end)