I am trying to make a rebirth GUI system where the user inputs the amount of rebirths they want and it will send the inputted amount through a remote event to serverscriptservice where it adds the inputted amount of rebirths. However I get this error -
ServerScriptService.rebirth:4: attempt to perform arithmetic (mul) on number and nil
Layout -
https://i.ibb.co/b2PcvYG/Capture.png
Local Rebirth Script -
script.Parent.MouseButton1Click:connect(function()
local amount = script.Parent.Parent.Parent.TextBox.Text
amount = tonumber(amount)
print(amount)
game.ReplicatedStorage.rebirth:FireServer(amount)
end)
ServerScriptService rebirth script -
game.Players.PlayerAdded:Connect(function(player, amount)
game.ReplicatedStorage.rebirth.OnServerEvent:Connect(function(player)
local leaderstats = player:FindFirstChild("leaderstats")
if leaderstats.Money.Value >= 1000000 * amount then
leaderstats.Rebirths.Value = leaderstats.Rebirths.Value + amount
leaderstats.Money.Value = 0
player.Character.Head:Destroy()
else
player.PlayerGui.Gui.badframe.Visible = true
wait(1)
player.PlayerGui.Gui.badframe.Visible = false
end
end)
end)
