I am trying to put a function (preview of lava damage) behind a gamepass but when try, It disables the function as a whole. I did test the code out without the gamepass lock and the function does work:

local id = 873589674
 
game.Players.PlayerAdded:connect(function(player)
    if Game:GetService("GamePassService"):PlayerHasPass(player, id) then
	script.Parent.Touched:connect(function(Part)
	Part.Parent.Humanoid.Health=Part.Parent.Humanoid.Health - 25
end
end)

the error says "Expected')'(to close'('at line 5), got 'end'

1 comment

1

You're missing an 'end)' to close the touched function