Basically this script is supposed to detect whether you have a gamepass or not, and if you do it'll give you 2 Clicks (money) when you click the block, and if you don't you'll only get 1.
local passId = 4961932
function isAuthenticated(player)
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end
function Start(plr)
print(plr.Name .. " has bought the game pass with id " .. passId)
end
game.Players.PlayerAdded:connect(function(plr)
if isAuthenticated(plr)
then local function OnClick(player)
player.leaderstats.Clicks.Value = player.leaderstats.Clicks.Value + 2
local f = Instance.new("Fire")
f.Parent = script.Parent.Head
game:GetService("Debris"):AddItem(f, .2)
else local function OnClick(player)
player.leaderstats.Clicks.Value = player.leaderstats.Clicks.Value + 1
local f = Instance.new("Fire")
f.Parent = script.Parent.Head
game:GetService("Debris"):AddItem(f, .2)
end
script.Parent.ClickDetector.MouseClick:Connect(OnClick)
The else is underlined red, and I'm not sure why. Right now the block doesn't give any Clicks at all.
This script works just fine, but it doesn't include the gamepass detector, and will only give 1 click regardless of if you have a gamepass or not.
local function OnClick(player)
player.leaderstats.Clicks.Value = player.leaderstats.Clicks.Value + 1
local f = Instance.new("Fire")
f.Parent = script.Parent.Head
game:GetService("Debris"):AddItem(f, .2)
end
script.Parent.ClickDetector.MouseClick:Connect(OnClick)
Could someone tell me what the issue is?
