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

How do I restrict this script to gamepass buyers?

Asked by 7 years ago
Edited 7 years ago

I'm going to leave it short here, I'm trying to make it so this script only works if you have a certain gamepass.

The script in question:

anim=Instance.new("Animation",workspace)
anim.AnimationId = "http://www.roblox.com/Asset?ID=293536378"
jun = script.Parent.Parent
Stuff = false
local sp = script.Parent
local s = Instance.new("Sound")
s.SoundId = "http://www.roblox.com/Asset?ID=507692428"
s.Volume = 0
s.Looped = false
s.PlayOnRemove = false
s.Parent = sp
--password
function ssj()
    s:Play()
    game:GetService("Chat"):Chat(jun.Character.Head,"Heheheh...",Enum.ChatColor.Red)
    game:GetService("Chat"):Chat(jun.Character.Head,"Don't you see?",Enum.ChatColor.Red)
    game:GetService("Chat"):Chat(jun.Character.Head,"I am a god...",Enum.ChatColor.Red) 
        for loop = 1,50 do
            delay(0,function()
            local x = Instance.new("Part")
            game.Debris:AddItem(x, 3)
            x.CanCollide = false
            x.Anchored = true
            x.Size = Vector3.new(1,1,1)
            x.Material = "Neon"
            x.TopSurface = "Smooth"
            x.BottomSurface = "Smooth"
            x.Parent = game.Workspace
            x.CFrame = jun.Character.Torso.CFrame
            x.BrickColor = BrickColor.new("Eggplant")

            local m1 = Instance.new("BlockMesh", x)
            delay(0,function()
            for loop = 1,20 do
                m1.Scale = m1.Scale + Vector3.new(1,1,1)
                x.CFrame = x.CFrame * CFrame.Angles(0.2,0.2,0.2)
                x.Transparency = x.Transparency + 0.05
                wait()
            end
            end)
            end)
            delay(0,function()
            local x = Instance.new("Part")
            game.Debris:AddItem(x, 4)
            x.Size = Vector3.new(1,1,1)
            x.CanCollide = false
            x.Anchored = true
            x.CFrame = jun.Character.Torso.CFrame * CFrame.new(0,-2.5,0)
            x.TopSurface = "Smooth"
            x.BottomSurface = "Smooth"
            x.BrickColor = BrickColor.new("Magenta")
            x.Parent = game.Workspace

            local m1 = Instance.new("SpecialMesh", x)
            m1.MeshId = "http://www.roblox.com/asset/?id=20329976"
            delay(0,function()
            for loop = 1,100 do
                m1.Scale = m1.Scale + Vector3.new(1,0.1,1)
                x.Transparency = x.Transparency + 0.02
                x.CFrame = x.CFrame * CFrame.Angles(0,1,0)
                wait()
            end
            end)
            end)
            wait(0.1)
        end

game:GetService("Chat"):Chat(jun.Character.Head,"I have mastered the form you call Super Saiyan.",Enum.ChatColor.Red)
game:GetService("Chat"):Chat(jun.Character.Head,"And modified it to my own tastes...",Enum.ChatColor.Red)
if Stuff == false then
Stuff = true
for u, c in pairs (jun.Character:GetChildren()) do
if c.className == "Accessory" and c.Name ~= "Swordpack" and c.Name ~= "GlassesBlackFrame" then
c.Handle.Transparency = 1
end
end
local Hair4 = game.ReplicatedStorage.SSJR:Clone()
Hair4.Parent = jun.Character
Hair4.Name = "Hair"
Hair4.CanCollide = false
Hair4.Locked = true
Hair4.CFrame = jun.Character.Torso.CFrame
local Weld = Instance.new("Weld")
Weld.Parent = jun.Character.Head
Weld.Part0 = jun.Character.Head
Weld.Part1 = Hair4
Weld.C0 = CFrame.new(0, .9, 0.11) * CFrame.Angles(0,math.pi,0)
if jun.Character.Torso:findFirstChild("PwnFire") == nil then
local animTrack = jun.Character.Humanoid:LoadAnimation(anim)
animTrack:Play()  
    wait()
    local fr = game.lighting.ParticleEmitterSSJR1:clone()
    fr.Parent = jun.Character.Torso
end
game:GetService("Chat"):Chat(jun.Character.Head,"...",Enum.ChatColor.Red)
game:GetService("Chat"):Chat(jun.Character.Head,"This is what I call, Super Saiyan Rose!",Enum.ChatColor.Red)
if jun.Character.Torso:findFirstChild("PwnSparkles") == nil then
    local cr = game.lighting.ParticleEmitterSSJR2:clone()
    cr.Parent = jun.Character.Torso
    local br = game.lighting.ParticleEmitterSSJR3:clone()
    br.Parent = jun.Character.Torso
end
jun.Character.Humanoid.MaxHealth = 1e+8
wait(0.3)
jun.Character.Humanoid.Health = 1e+8
end
end
function nossj()
if Stuff == true then
Stuff = false
if jun.Character.Torso:findFirstChild("ParticleEmitterSSJR1")~=nil then
jun.Character.Torso:findFirstChild("ParticleEmitterSSJR1"):Remove()
end
if jun.Character.Torso:findFirstChild("ParticleEmitterSSJR2")~=nil then
jun.Character.Torso:findFirstChild("ParticleEmitterSSJR2"):Remove()
end
if jun.Character.Torso:findFirstChild("ParticleEmitterSSJR3")~=nil then
jun.Character.Torso:findFirstChild("ParticleEmitterSSJR3"):Remove()
end
game:GetService("Chat"):Chat(jun.Character.Head,"You fools...",Enum.ChatColor.Green)
game:GetService("Chat"):Chat(jun.Character.Head,"That's what you get for underestimating me...",Enum.ChatColor.Green)
     local p = Instance.new("Part")
     p.Parent = jun.Character
     p.Anchored = true
     p.CanCollide = false
     p.Transparency = 0.1
     p.formFactor = "Symmetric"
     p.Size = Vector3.new(22, 22, 22)
     p.TopSurface = "Smooth"
     p.BottomSurface = "Smooth"
     p.Name = "Sharingan"
     p.Shape = "Ball"
     p.CFrame = jun.Character.Torso.CFrame
     p.BrickColor = BrickColor.new("Magenta")
     for i = 1 , 10 do
      wait(0.05)
      p.Size = p.Size + Vector3.new(-4, -4, -4)
      p.Transparency = p.Transparency + 0.1
      p.CFrame = jun.Character.Torso.CFrame
     end
s.Volume = 0
p:Remove()
for u, c in pairs (jun.Character:GetChildren()) do
if c.className == "Accessory" and c.Name ~= "Swordpack" and c.Name ~= "GlassesBlackFrame" then
c.Handle.Transparency = 0
end
if c.Name == "Hair" then
c:Remove()
end
end
jun.Character.Humanoid.Health = 100
wait(0.3)
jun.Character.Humanoid.MaxHealth = 100
end
end
jun.Chatted:connect(function(Msg)
 local msg = Msg:lower()
 if string.sub(msg, 1, 7) == "Super Saiyan Rose" then
 wait(0.1)
  ssj()
 end
 if string.sub(msg, 1, 13) == "ssjr" then
 wait(0.1)
  ssj()
 end
 if string.sub(msg, 1, 6) == "ssr" then
 wait(0.1)
  ssj()
 end
 if string.sub(msg, 1, 10) == "calm" then
 wait(0.1)
  nossj()
 end
 if string.sub(msg, 1, 3) == "off" then
 wait(0.1)
  nossj()
 end
end)
function OnDeath()
wait()
nossj()
end
jun.Character.Humanoid.Died:connect(OnDeath)
jun = script.Parent.Parent
Stuff = false
--mediafire---

1 answer

Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
7 years ago

Use MarketplaceService:PlayerOwnsAsset() using the integer Id of the gamepass. It's in the pass url on the website.

0
Ah thanks. Where would I actually put this in the huge garble of a script though? DerpzGamez 6 — 7y
0
Would you do an 'if then' statement? Nik1080 24 — 7y
0
Yeah maybe at the very beginning cabbler 1942 — 7y
0
It didn't work, it instead stopped the entire script from functioning. DerpzGamez 6 — 7y
View all comments (3 more)
0
That's the point cabbler 1942 — 7y
0
No, I mean it didn't let me use it even though I owned the gamepass I was using to test it by default. DerpzGamez 6 — 7y
0
mg. jun = script.Parent.Parent. if MarketplaceService:PlayerOwnsAsset(jun,id) then cabbler 1942 — 7y
Ad

Answer this question