Trouble getting the user

I am trying to make a certain user get more clicks.

image

local button = script.Parent
local event = game.ReplicatedStorage.ClickEvent
local MarketPlaceService = game:GetService("MarketplaceService")
local GamePassID = 14905680
local userInput = game:GetService('UserInputService')
local GamePassID1 = 13113462
local playerId = 2372208237


event.OnServerEvent:Connect(function(player)
	player.leaderstats.Clicks.Value += 1
	if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamePassID) then
		player.leaderstats.Clicks.Value += 999
	elseif game:GetService(player.UserId, playerId) then
		player.leaderstats.Clicks.Value += 999999999
	end
end)

game:GetService(player.UserId, playerId) is not a service.
I think you meant to put MarketPlaceService:UserOwnsGamePassAsync(player.UserId, playerId) instead.

Also, playerId cannot be a userid as it has to be the gamepass id.

I want a certain player to get more clicks, how would I do that?

You can do that by checking the player’s userid/name, however userid is the best way as that cannot be changed.

if table.find(Whitelisted, UserId) then
   -- give them whatever.
end

What do you mean by ‘Whitelisted’?

Whitelisted is a table where you can add potential userids.

Would you get the userid from the player? Like this player.UserId Sorry if I am being kind of annoying I am a beginner scripter.

Player.UserId returns what you need.

event.OnServerEvent:Connect(function(player)
	player.leaderstats.Clicks.Value += 1
	if MarketPlaceService:UserOwnsGamePassAsync(player.UserId, GamePassID) then
		player.leaderstats.Clicks.Value += 999
	elseif player.UserId == playerId then
		player.leaderstats.Clicks.Value += 999999999
	end
end)

Thanks. I should have not put extra stuff.

1 Like