So I started working on a rebirth system using remotevents, This is what I got so far
Server:
local function returnRebirthInfo(amount)
for i, info in pairs(RebirthModule) do
if info.Amount == amount then
return info
end
end
return RebirthModule[1]
end
Event.OnServerEvent:Connect(function(player, amount)
local rebirthInfo = returnRebirthInfo(amount)
if rebirthInfo ~= nil then
if player.leaderstats.Coins.Value > rebirthInfo.Cost then
player.leaderstats.Coins.Value = 0
player.leaderstats.Rebirths.Value += rebirthInfo.Amount
end
end
end)
Module:
local Rebirths = {
[1] = {Amount = 1, Cost = 100},
}
return Rebirths
Localscript:
for i,v in pairs(RebirthsModule) do
script.Parent.Text = v["Amount"] .. " Rebirths for " .. v["Cost"] .. " Coins"
script.Parent.Name = v["Amount"]
end
for _,v in pairs (rebirths.List.Holder.rebirth:GetChildren()) do
if v:IsA("TextButton") then
v.Buy.MouseButton1Click:Connect(function()
Event:FireServer()
end)
end
end
so my problem is that the studio and console dont throw any Errors but the game dosent react/remove/give the coins or rebirths, the main reason I am using a amount system is so I can add new Buttons in the feature, I have been trying for some time now and I cant find any solution to make it work. Help would be very nice