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

Group/Gamepass Horse Somewhat Working?

Asked by
54013 -2
6 years ago

So I'm in a group and I am trying to make a gamepass for a horse that also works for HR's and Cavalry without them needing the game pass.

It somewhat works, it'll kill anyone who isn't a HR, has the pass, or isn't in the cavalry. However, if someone who are one of those things gets on the horse then hops off the script stops working and anyone can ride it no matter who they are.

Here's what I have:

check = false


script.Parent.Touched:connect(function(Part)
if check == false then
    local b = Part.Parent:FindFirstChild("Humanoid")
    if b ~= nil then
        local player = game.Players:GetPlayerFromCharacter(Part.Parent) 
            if game:GetService('GamePassService'):PlayerHasPass(player, 4433975) then
                print ('owns pass')

            elseif player:GetRankInGroup(3977710) >= 17 then
                print('owns pass')

            elseif player:GetRankInGroup(4100024) >= 1 then
                print('owns pass')

            elseif game:GetService('GamePassService'):PlayerHasPass(player, 4433975) then
                print ('owns pass')

            else
                Part.Parent.Humanoid.Health = 0

            end
end
    end
end)
0
is the script inside a seat hellmatic 1523 — 6y
0
It is inside a seat 54013 -2 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

dont use gamepass service use game:GetService("MarketplaceService"):UserOwnsGamepassAsync or playerownsasset

Ad

Answer this question