(SOLVED) How to give rewards for players favoriting your game

in the game RIVALS players can favorite the game for rewards. How did they do this?

I looked into it and there is documentation here: AvatarEditorService | Documentation - Roblox Creator Hub

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)

3 Likes

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

2 Likes

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!

1 Like

So How do you check from server?

Thats what I’m currently planning on doing. I just am not sure how to check from the server

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.

2 Likes

So I can’t check on the server if they have favorited the game? I have to check on client then let the server know?

I’m wondering if it is possible to check on the server

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.

2 Likes

You can detect if a player has favorited a game, there’s an API URL for that. Give me a few seconds to find it.

1 Like

https://games.roblox.com/docs//index.html


Use the GamesV2 URL and loop through all of those games and check if one of them is your game.

2 Likes

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

1 Like

I summarized the answer in the script that I have sent

client sends a remote event when player favorite the game
server checks if the player didn’t claim the favorite reward before
if though then reward

1 Like

Please mark the post which gave you the solution as “solution”, renaming your post is not enough

I was kinda confused since there was multiple answers and it seemed rude to give the answer to myself

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