How to see if a player liked your game

Hey everyone, so im trying to figure out how I can check to see if a player liked my game like sorta how the game rivals dose it any ideas?

local Players = game:GetService("Players")
local GameService = game:GetService("GameService")
local TweenService = game:GetService("TweenService")

local inviteButton = script.Parent
local player = Players.LocalPlayer

-- All Popups --
local PopUpModule = require(game.ReplicatedStorage.Modules.PopUp)

local colorseq = ColorSequence.new({
	ColorSequenceKeypoint.new(0, Color3.new(1, 1, 1)),
	ColorSequenceKeypoint.new(1, Color3.new(0.7, 0.7, 0.7)),
})

-- Warning Ones
local propertiesBad = { 
	["Sound"] = game.SoundService:FindFirstChild("SoundBad"), -- plays sound when sending pop up
	["Gradient"] = {Color = colorseq, Rotation = 90}, -- use custom gradient
}

-- Good Ones
local propertiesGood = { 
	["Sound"] = game.SoundService:FindFirstChild("SoundGood"), -- plays sound when sending pop up
	["Gradient"] = {Color = colorseq, Rotation = 90}, -- use custom gradient
}

-- Bad Ones
local function tween(object, tweenInfo, propertiesBad)
	return TweenService:Create(object, tweenInfo, propertiesBad)
end

-- Good ones
local function tween(object, tweenInfo, propertiesGood)
	return TweenService:Create(object, tweenInfo, propertiesGood)
end
-- End Of Popups --

-- Adding sound assets
local hoverSound = inviteButton:WaitForChild("HoverSound")
local clickSound = inviteButton:WaitForChild("ClickSound")

-- Function to handle the click event
local function handleButtonClick()
	-- Check if the player is valid
	if not player then
		return
	end

	-- Check if the player has liked the game
	local success, hasLiked = pcall(function()
		return GameService:PlayerHasLikedAsync(player.UserId)
	end)

	if success and hasLiked then
		-- Give 50 coins to the player
		-- Replace this with your actual coin giving logic
		-- For example:
		-- CoinsModule:GiveCoins(player, 50)
		PopUpModule.Pop.Local("You've earned 50 coins!", Color3.new(0, 1, 0.117647), 3, {"Fade", "Fade"}, propertiesGood)
	else
		-- Prompt the player to like the game
		PopUpModule.Pop.Local("Please like our game to earn rewards!", Color3.new(1, 0, 0), 3, {"Fade", "Fade"}, propertiesBad)
	end
end

-- Connect button events
inviteButton.MouseEnter:Connect(function()
	hoverSound:Play()
	tween(inviteButton.UIScale, TweenInfo.new(0.08), {Scale = 1.05}):Play()
end)

inviteButton.MouseLeave:Connect(function()
	tween(inviteButton.UIScale, TweenInfo.new(0.08), {Scale = 1}):Play()
end)

inviteButton.MouseButton1Down:Connect(function()
	clickSound:Play()
	tween(inviteButton.UIScale, TweenInfo.new(0.08), {Scale = 0.95}):Play()
end)

inviteButton.MouseButton1Up:Connect(function()
	tween(inviteButton.UIScale, TweenInfo.new(0.08), {Scale = 1.05}):Play()
end)

inviteButton.MouseButton1Click:Connect(handleButtonClick)

2 Likes

Don’t quote me on this, but I do not think there is a way to know, most games that say “Free ____ for liking the game and joining the group!” give you the item for just joining the group as I do not there is a way and it is mainly just to manipulate kids into liking you game…

There is a way to tell as I have seen actually, which Im pretty sure external ways of getting it

1 Like