REPOSTED BECAUSE DIDNT GET ANSWER SORRY
this is the regular script inside a textbutton in a frame in a screengui
no errors
local Part = script.Parent
Part.MouseButton1Click:Connect(function()
local player = script.Parent.Parent.Parent.Parent.Parent
if player then
local leaderstats = player:WaitForChild("leaderstats")
local Currency = leaderstats.Rebirths
local Selling = leaderstats.Coins
if (Selling.Value >= 1500) then
Currency.Value = Currency.Value + Selling.Value + 1
Selling.Value = 0
player.leaderstats.Changes.Value = 0
game.Workspace.clink.Playing = true
wait(2)
game.Workspace.clink.Playing = false
end
end
end)
Idk how to get the sound "clink" to just play for the local player, because it would not play when inside the scripts Parent.
its also converting all coins to rebirths and adding 1, how fix?

4 comments
got error from client side on line 7 in local script for InvokeServer is not valid child of Rebirth, and on server side a error for the sss script on line 3 saying OnServerInvoke isnt a child either
is it a RemoteFunction or a RemoteEvent? if it is a Remote Event, replace InvokeServer with FireServer, and replace OnServerInvoke with OnServerEvent
if you want it to be a remotefunction but rebirth event is a remote event (i explained why in this case you should use remote function), keep the script, and replace the rebirth remote event with a remote function with the same name
and also, i realised that what i did on my normal script was wrong. What i should've done was di Rebirth.OnServerInvoke = function(player) (you will need to remove the ")" at line 11)