I keep getting OnServerInvoke is not a valid member of RemoteEevent
Invoke server script
1 | while true do |
2 | wait( 60 ) |
3 | mainmod:Appear() |
4 | mainmod:Spin( 5 ) |
5 | game.Workspace.DataStore.StoreData:InvokeClient(script.Parent.Parent.Parent.Name, script.Parent.Parent.MoneyDisplay.Money.TextLabel.Text) |
6 | mainmod:Dissapear() |
7 | end |
Reciver
1 | script.StoreData.OnServerInvoke( function (player, amount) |
2 | MoneyStore:SetAsync( "Money_" ..player, amount) |
3 | end ) |
Use OnServerInvoke as an event
1 | script.StoreData.OnServerEvent:connect( function (player, amount) |
2 | MoneyStore:SetAsync( "Money_" ..player, amount) |
3 | 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.
1 | script.StoreData.OnServerEvent:connect( function (amount) |
2 | MoneyStore:SetAsync( "Money_" ..game:GetService( "Players" ).LocalPlayer, amount) |
3 | end ) |
1 | while wait( 60 ) do |
2 | mainmod:Appear() |
3 | mainmod:Spin( 5 ) |
4 | game.Workspace.DataStore.StoreData:InvokeClient(game:GetService( "Players" ):GetPlayerFromCharacter(script.Parent.Parent.Parent), script.Parent.Parent.MoneyDisplay.Money.TextLabel.Text) |
5 | mainmod:Dissapear() |
6 | end |
Hope it helps!