local gamepass = 16730719 local market = game:GetService("MarketplaceService") local replicatedStorage = game:GetService("ReplicatedStorage") game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(Character) if market:UserOwnsGamePassAsync(player.UserId, gamepass) then replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player) player.leaderstats.Views.Value = player.leaderstats.Views.Value + 2 else replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player) player.leaderstats.Views.Value = player.leaderstats.Views.Value + 1 end end) end end) end)
there is actually 2 errors error 1: Error: (10,3) Syntax error: Expected 'end' (to close 'function' at line 8), got 'else'
error 2: Error: (14,3) Syntax error: Expected ')' (to close '(' at line 11), got 'end'
The error means the code expected an end to close on the event of OnServerEvent to enclose the function! You didn't add an end with a parenthesis on line 13, and therefore got the error: Expected ')' (to close '(' at line 11), got 'end'
Add the end with an ending parenthesis like this end)
on line 13
local gamepass = 16730719 local market = game:GetService("MarketplaceService") local replicatedStorage = game:GetService("ReplicatedStorage") game.Players.PlayerAdded:Connect(function(player) player.CharacterAdded:Connect(function(Character) if market:UserOwnsGamePassAsync(player.UserId, gamepass) then replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player) player.leaderstats.Views.Value = player.leaderstats.Views.Value + 2 end) else replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player) player.leaderstats.Views.Value = player.leaderstats.Views.Value + 1 end) end end) end)
I originally thought you had two too many ends, but it seems that you've nested two listeners.
local gamepass = 16730719 local market = game:GetService("MarketplaceService") local replicatedStorage = game:GetService("ReplicatedStorage") replicatedStorage.Remotes.Lift.OnServerEvent:Connect(function(player) if market:UserOwnsGamePassAsync(player.UserId, gamepass) then player.leaderstats.Views.Value = player.leaderstats.Views.Value + 2 else player.leaderstats.Views.Value = player.leaderstats.Views.Value + 1 end end)
You don't need the PlayerAdded nor the CharacterAdded event as you already get player from the client when firing a RemoveEvent. I do not think you can nest a listener inside an event either.