The problem with this is that you cant do it via the server, only the client. Now that wouldn’t be such a bad thing except if you want to check if a player has favorited the game. That also has to be done on the client.
So if you want to give a player rewards (currency) inside your game you have to first prompt the player to set your game as a favorite, then you have to check if it is in their favorites and if it is, then give them money. But since the first 2 steps of that have to be done on the client, there is no way to make it secure against exploiters! You just have to completely trust the client via remote event.
Here is a video explaining it better then I did right HERE
(Watch between 3 and 6 minutes mark for the important info)
I may be wrong but when I played rivals on its release I got the reward after clicking the button a few times without even favoriting the game
actually there is
server
playerFavouritedGame.OnServerEvent:Connect(function(player)
if player.gotFavouriteReward.Value == false then
player.gotFavouriteReward.Value = true
-- reward the player
end
end)
I have never tried Avatar editor service but its not much of a problem if the player got favoriting reward even when he Didot favorite the game since he cannot do it more than once
Along with what the guy above me said. You give the reward from the server under a check. That’s how you should be structuring your game all-around too!
Well first, you’ll have to have a way to store a variable that checks if the player has ever got the Reward before, so somewhere in your datastore (If u have one).
^^ And yes regular games normally have variables like this no matter how small of a job it is, variables are cheap on performance.
Then just do an if statement grabbing the players datastore and checking if they ever got the reward. Then if they haven’t gotten it yet, then update the datastore to make it true, then give the player the reward. Boom.
No you can’t, just have the client send a remote event if the player has favorited the game. Then have the server check if they had the reward before. No way around it. I guarantee you that it’s how Rivals did it.
I have a solution. You just have to check on the client if a player favorited the game and if they did then let the server know via remote-event. This is exploitable but like @GE_0E said. if someone was to exploit it would be fine since they can only get the reward once anyways. so as long as your reward isn’t worth protecting then who cares if some guy doesn’t favorite it. the mass majority will have to favorite.
And like @SomeFedoraGuy shared there is a way to check on the server.
In my case I am only offering 40 coins as a reward so I will do the first option since the second tends to be more complicated (for me anyways). But it is definitely doable if you want to secure your reward fully from exploiters
Understandable, I guess award it to the one you think helped you the most, so that other people who may stumble on your post find the same exact solution very quickly. Now if the choice is hard, it’s still better to put the topic as solved so that others know they will find at least one solution. It’s not supposed to be a competition but I see where you’re coming from