generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Problem with gamepass on enter script:

Previous Thread :: Next Thread 
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
01 Aug 2013 07:39 PM
Doesn't work, even when I have a gamepass. And the other problem is that if I remove the "if" statement at the part where it checks if the player has it, everyone will spawn with the items. Help?


function onPlayerRespawned(newPlayer)

local GamePassService = Game:GetService('GamePassService')
local PlayersService = Game:GetService('Players')

wait(5)
if game:GetService("GamePassService"):PlayerHasPass(newPlayer, 124827462) then
w = game.Lighting.UBERWeps:GetChildren()
for i = 1,#w do
w[i]:Clone().Parent = newPlayer.Backpack
end
end

function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
end

game.Players.PlayerAdded:connect(onPlayerEntered)
Report Abuse
sam8985 is not online. sam8985
Joined: 12 Nov 2011
Total Posts: 582
01 Aug 2013 07:51 PM





function onPlayerEntered(newPlayer)
newPlayer.ChildAdded:wait()
if game:GetService("GamePassService"):PlayerHasPass(newPlayer,124827462) then
w = game.Lighting.UBERWeps:GetChildren()
for i,v in pairs(w) do
v:Clone().Parent = newPlayer.StarterGear
end
end
end

game.Players.PlayerAdded:connect(onPlayerEntered)
Report Abuse
1billybob1 is not online. 1billybob1
Joined: 15 Jun 2008
Total Posts: 4852
01 Aug 2013 08:07 PM
Doesn't work.
Report Abuse
sam8985 is not online. sam8985
Joined: 12 Nov 2011
Total Posts: 582
02 Aug 2013 01:25 AM
function Check(player,id)
return game:GetService("GamePassService"):PlayerHasPass(player,id)
end

game.Players.PlayerAdded:connect(function(newPlayer)
if Check(newPlayer,124827462) then
newPlayer.CharacterAdded:connect(function()
w = game.Lighting.UBERWeps:GetChildren()
for i,v in pairs(w) do
v:Clone().Parent = newPlayer.Backpack
end
end)
end
end)
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
02 Aug 2013 01:30 AM
game.Players.PlayerAdded:connect(function(p)
if game.GamePassService:PlayerHasPass(p,124827462) then
for _,v in pairs(game.Lighting.UBERWEPS:GetChildren())do
v:Clone().Parent=p.StarterGear
end
p:LoadCharacter()
end
end)
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image