I keep getting OnServerInvoke is not a valid member of RemoteEevent
Invoke server script
while true do wait(60) mainmod:Appear() mainmod:Spin(5) game.Workspace.DataStore.StoreData:InvokeClient(script.Parent.Parent.Parent.Name, script.Parent.Parent.MoneyDisplay.Money.TextLabel.Text) mainmod:Dissapear() end
Reciver
script.StoreData.OnServerInvoke(function(player, amount) MoneyStore:SetAsync("Money_"..player, amount) end)
Use OnServerInvoke as an event
script.StoreData.OnServerEvent:connect(function(player, amount) MoneyStore:SetAsync("Money_"..player, amount) end)
edit - changed to OnServerEvent
Do what @SFOH said to do, use OnServerEvent instead of OnServerInvoke, also, you forgot the "connect" part or your code. But there is another error in your first script, If you're invoking a local script you need the first argument to be the PLAYER. Not the Player's NAME.
script.StoreData.OnServerEvent:connect(function(amount) MoneyStore:SetAsync("Money_"..game:GetService("Players").LocalPlayer, amount) end)
while wait(60) do mainmod:Appear() mainmod:Spin(5) game.Workspace.DataStore.StoreData:InvokeClient(game:GetService("Players"):GetPlayerFromCharacter(script.Parent.Parent.Parent), script.Parent.Parent.MoneyDisplay.Money.TextLabel.Text) mainmod:Dissapear() end
Hope it helps!