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: Gamepass GUI

Previous Thread :: Next Thread 
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
19 Nov 2012 03:52 PM
This script is suppose to detect whether one owns a specific gamepass, if owned, the GUI is visible, if not owned, the GUI is not visible. This is what I've done.

local passId = 93044440 -- Pass ID
permission = {""} -- People that may pass without the game pass

function authenticate(player) -- checks to see if the player owns the pass
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
if authenticate(plr) then
if (passId = 93044440 ) then
then game.StarterGUI.Teleport.Visible = true
else game.StarterGUI.Teleport.Visible = false
end
end) -- by RoyMer
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
19 Nov 2012 03:58 PM
Output: Workspace.VIP:10: ')' expected near '='
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
19 Nov 2012 03:59 PM
local passId = 93044440 -- Pass ID
permission = {""} -- People that may pass without the game pass

function authenticate(player) -- checks to see if the player owns the pass
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
if authenticate(plr) then
if (passId == 93044440 ) then
then game.StarterGUI.Teleport.Visible = true
else game.StarterGUI.Teleport.Visible = false
end
end) -- by RoyMer
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
19 Nov 2012 04:00 PM
Output: Workspace.VIP:11: unexpected symbol near 'then'
Report Abuse
blackboy167thst is not online. blackboy167thst
Joined: 22 Jul 2011
Total Posts: 2468
19 Nov 2012 04:01 PM
local passId = 93044440 -- Pass ID
permission = {""} -- People that may pass without the game pass

function authenticate(player) -- checks to see if the player owns the pass
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
if authenticate(plr) then
if (passId == 93044440 ) then
game.StarterGUI.Teleport.Visible = true
else game.StarterGUI.Teleport.Visible = false
end
end) -- by RoyMer
Report Abuse
crouton04 is not online. crouton04
Joined: 07 Jul 2010
Total Posts: 4459
19 Nov 2012 04:04 PM
After then dont put another then in the next line..
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
19 Nov 2012 04:05 PM
Trying to write something but getting an error.
Report Abuse
thedeathmaster01 is not online. thedeathmaster01
Joined: 14 Mar 2010
Total Posts: 6331
19 Nov 2012 04:07 PM
local passId = 93044440 -- Pass ID
permission = {""} -- People that may pass without the game pass

function authenticate(player) -- checks to see if the player owns the pass
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:wait()
if authenticate(plr) then
plr.PlayerGui.Teleport.Visible = true
else plr.PlayerGui.Teleport.Visible = false
end
end) -- by RoyMer
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
19 Nov 2012 04:11 PM
@thedeathmaster01, it's not giving me any output but it's not working, the script has to be in the workspace, right?
Report Abuse
LiamScerri is not online. LiamScerri
Joined: 10 Oct 2010
Total Posts: 560
19 Nov 2012 04:15 PM
local passId = 93044440 -- Pass ID
permission = {""} -- People that may pass without the game pass

function authenticate(player) -- checks to see if the player owns the pass
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(fuction(char)
if authenticate(plr) then
plr.PlayerGui.Teleport.Visible = true
else plr.PlayerGui.Teleport.Visible = false
end
end)
end) -- by OxxOmmok

ipprova b'dan.

u taghmiliex solo,
ghamel server. k?
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
19 Nov 2012 04:22 PM
None are working as I want them to work, does the script have to be in the workspace?
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
19 Nov 2012 04:27 PM
It's not giving me any output yet it's not working :/
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
20 Nov 2012 04:10 AM
local passId = 93044440 -- Pass ID
permission = {""} -- People that may pass without the game pass

function authenticate(player) -- checks to see if the player owns the pass
return game:GetService("GamePassService"):PlayerHasPass(player, passId)
end

game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(fuction(char)
if authenticate(plr) then
plr.PlayerGui.Teleport.Visible = true
elseif passId ~= 9304440 then plr.PlayerGui.Teleport.Visible = false
end
end
end) -- by RoyMer Still not working
Report Abuse
awas3 is not online. awas3
Joined: 24 Oct 2010
Total Posts: 2854
20 Nov 2012 05:41 AM
Output? No output then, once you run the script, reset because sometimes Guis dont appear straight away in startergui, you would have to interact with the player's gui.

~A3~
Report Abuse
awas3 is not online. awas3
Joined: 24 Oct 2010
Total Posts: 2854
20 Nov 2012 05:44 AM
Try this, Its a little inefficient but as long as it works, its fine.



local passId = 93044440 -- Pass ID
permission = {""} -- People that may pass without the game pass


game.Players.PlayerAdded:connect(function(plr)
plr.CharacterAdded:connect(fuction(char)
if game:GetService("GamePassService"):PlayerHasPass(player, passId) then
plr.PlayerGui.Teleport.Visible = true
else
plr.PlayerGui.Teleport.Visible = false
end
end
end) -- by RoyMer Still not working


Oh and no need for that "elseif passId ~=" blah, just a simple else statement would do.

~A3~
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
20 Nov 2012 06:07 AM
Wow that worked but now there's another problem, when I die or reset the GUI doesn't appear back.
Report Abuse
awas3 is not online. awas3
Joined: 24 Oct 2010
Total Posts: 2854
20 Nov 2012 06:14 AM
Yeh it wouldnt, because the script only works when a player enters. Wait I'll figure a way out.


~A3~
Report Abuse
awas3 is not online. awas3
Joined: 24 Oct 2010
Total Posts: 2854
20 Nov 2012 06:17 AM
local passId = 93044440 -- Pass ID
permission = {""} -- People that may pass without the game pass

function check()
if game:GetService("GamePassService"):PlayerHasPass(player, passId) then
plr.PlayerGui.Teleport.Visible = true
else
plr.PlayerGui.Teleport.Visible = false
end
end

game.Players.PlayerAdded:connect(function(plr)
if game:GetService("GamePassService"):PlayerHasPass(player, passId) then
plr.PlayerGui.Teleport.Visible = true
else
plr.PlayerGui.Teleport.Visible = false
end
plr.CharacterAdded:connect(function()
check()
end)
end)
-- By RoyMer, Edited by: awas3


~A3~
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
20 Nov 2012 06:20 AM
It still isn't appearing after respawn :/
Report Abuse
awas3 is not online. awas3
Joined: 24 Oct 2010
Total Posts: 2854
20 Nov 2012 06:26 AM
local passId = 93044440 -- Pass ID
permission = {""} -- People that may pass without the game pass


game.Players.PlayerAdded:connect(function(plr)
if game:GetService("GamePassService"):PlayerHasPass(player, passId) then
plr.PlayerGui.Teleport.Visible = true
else
plr.PlayerGui.Teleport.Visible = false
end
plr.CharacterAdded:connect(function()



while true do
wait()
if game:GetService("GamePassService"):PlayerHasPass(player, passId) then
plr.PlayerGui.Teleport.Visible = true
else
plr.PlayerGui.Teleport.Visible = false
end
end


-- By RoyMer, Edited by: awas3


~A3~
Report Abuse
awas3 is not online. awas3
Joined: 24 Oct 2010
Total Posts: 2854
20 Nov 2012 06:27 AM
Or if it doesnt work, on the while true do bit, third line, replace "player" with game.Players.LocalPlayer and put the code into a LocalScript.

~A3~
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
20 Nov 2012 06:32 AM
could I do player = game.Players.LocalPlayer
to shorten a bit?
Report Abuse
awas3 is not online. awas3
Joined: 24 Oct 2010
Total Posts: 2854
20 Nov 2012 06:40 AM
Yep.

~A3~
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
20 Nov 2012 06:41 AM
Nevermind, the code before did work, I might have done some mistake while testing it.
Report Abuse
RoyMer is not online. RoyMer
Joined: 06 Jan 2010
Total Posts: 1922
20 Nov 2012 06:42 AM
Thank you all who helped me.

-- Thread Closed --
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