Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

how do I lock a function behind a gamepass?

Asked by 6 years ago
Edited 6 years ago

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
You're missing an 'end)' to close the touched function Netflixy 126 — 6y

Answer this question