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: Beginner Script Help (repost, didn't follow the rules)

Previous Thread :: Next Thread 
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 07:39 PM
I know this is simple, but can someone please tell me why this isn't working?

gamepassid=145239504

function click()
if game:GetService("GamePassService"):PlayerHasPass(script.Parent.Parent, gamepassid) then
if script.Parent.Parent.Parent.Parent.Shed.Main.Visible == false then script.Parent.Parent.Parent.Parent.Shed.Main.Visible = true
else
script.Parent.Parent.Parent.Parent.Shed.Main.Visible = false
end
end
script.Parent.MouseButton1Click:connect(onClick)
end


I expected it to have the Main frame in "Shed" to to become visible and invisible only if you have a gamepass.
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 07:41 PM
function click()
if game:GetService("GamePassService"):PlayerHasPass(script.Parent.Parent, gamepassid) then
if script.Parent.Parent.Parent.Parent.Shed.Main.Visible == false then script.Parent.Parent.Parent.Parent.Shed.Main.Visible = true
else
script.Parent.Parent.Parent.Parent.Shed.Main.Visible = false
end
end
end

script.Parent.MouseButton1Click:connect(onClick)
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 07:43 PM
Didn't work
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 07:44 PM
everything seems fine, Then again I dont really use gamepass things.
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 07:46 PM
Yeah, I got the exact same result, which was it expected me to click on it but it didn't open.
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 07:53 PM
I know for a fact that the

if script.Parent.Parent.Parent.Parent.Shed.Main.Visible == false then script.Parent.Parent.Parent.Parent.Shed.Main.Visible = true
else
script.Parent.Parent.Parent.Parent.Shed.Main.Visible = false

part is right, it worked on my other classes. I have enough "ends," I think the problem is the
gamepassid=145239504

function click()
if game:GetService("GamePassService"):PlayerHasPass(script.Parent.Parent, gamepassid) then
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 07:53 PM
So the button doesnt show? or it does show?
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 07:56 PM
It does show, the button highlights when I mouse over it and gives me the fingar. When I click though, nothing happens. This does work without the gamepass part, I know because I have other classes that don't need a gamepass, and they work.
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 07:57 PM
gamepassid=145239504

function click()
if game:GetService("GamePassService"):PlayerHasPass(script.Parent.Parent, gamepassid) then
if script.Parent.Parent.Parent.Parent.Shed.Main.Visible == false then script.Parent.Parent.Parent.Parent.Shed.Main.Visible = true
else
script.Parent.Parent.Parent.Parent.Shed.Main.Visible = false
end
end
end

scrpt.Parent.MouseButton1Down:connect(click)
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 07:58 PM
--Sorry, this one.

gamepassid=145239504

function click()
if game:GetService("GamePassService"):PlayerHasPass(script.Parent.Parent, gamepassid) then
if script.Parent.Parent.Parent.Parent.Shed.Main.Visible == false then script.Parent.Parent.Parent.Parent.Shed.Main.Visible = true
else
script.Parent.Parent.Parent.Parent.Shed.Main.Visible = false
end
end
end

script.Parent.MouseButton1Down:connect(click)
Report Abuse
jjj344 is not online. jjj344
Joined: 19 Dec 2010
Total Posts: 12709
07 Feb 2014 08:01 PM
Your script has a capitalization error.
gamepassID=145239504

function click()
if game:GetService("GamePassService"):PlayerHasPass(script.Parent.Parent, gamepassid) then
if script.Parent.Parent.Parent.Parent.Shed.Main.Visible == false then script.Parent.Parent.Parent.Parent.Shed.Main.Visible = true
else
script.Parent.Parent.Parent.Parent.Shed.Main.Visible = false
end
end
script.Parent.MouseButton1Click:connect(onClick)
end

My ma always said.. life is like a box of chocolates.. *nom nom* never know what you gonna get.
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 08:02 PM
jj, that is incorrect, he tagged it like that.
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 08:09 PM
Neither worked, same result for all.
Report Abuse
jjj344 is not online. jjj344
Joined: 19 Dec 2010
Total Posts: 12709
07 Feb 2014 08:09 PM
I thought the ID had to capitilized.
I'm new here at Scripting so I'm learning.

My ma always said.. life is like a box of chocolates.. *nom nom* never know what you gonna get.
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 08:13 PM
gamepassid=145239504
g = game:GetService("GamePassService")

function click()
if g:PlayerHasPass(script.Parent.Parent, gamepassid) then
if script.Parent.Parent.Parent.Parent.Shed.Main.Visible == false then script.Parent.Parent.Parent.Parent.Shed.Main.Visible = true
else
script.Parent.Parent.Parent.Parent.Shed.Main.Visible = false
end
end
end

script.Parent.MouseButton1Down:connect(click)

--[[Give this a shot. I cant test it, i dont have studio on this desktop and I cant download it (nor roblox.)]]
Report Abuse
Duelingwarlord is not online. Duelingwarlord
Joined: 15 Feb 2010
Total Posts: 22333
07 Feb 2014 08:13 PM
output
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 08:52 PM
Latest script didn't work.
Also @above, how do you use output during the actual game?
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 08:53 PM
theres something roblox created for that, search "roblox error monitoring" in free models.
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 08:56 PM
I used the output in playsolo, error at line 5:

if g:PlayerHasPass(script.Parent.Parent, gamepassid) then
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 08:57 PM
This is the entire script:

gamepassid=145239504
g = game:GetService("GamePassService")

function click()
if g:PlayerHasPass(script.Parent.Parent, gamepassid) then
if script.Parent.Parent.Parent.Parent.Shed.Main.Visible == false then script.Parent.Parent.Parent.Parent.Shed.Main.Visible = true
else
script.Parent.Parent.Parent.Parent.Shed.Main.Visible = false
end
end
end

script.Parent.MouseButton1Down:connect(click)

Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 08:58 PM
PlayerHasPass(script.Parent.Parent, gamepassid)

what is the "script.Parent.Parent, gamepassid" for?
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 09:03 PM
Testing the player for the gamepass. That could be it.
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
07 Feb 2014 09:04 PM
PlayerHasPass(gamepassid)

try that instead? I dont think it will work, i havent used game passes.
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 09:04 PM
I think I don't have enough .Parents
Report Abuse
MrAlexCommaNet is not online. MrAlexCommaNet
Joined: 28 Jun 2011
Total Posts: 383
07 Feb 2014 09:12 PM
The .Parents was the problem. It's fixed now.
Thanks to XtremeTemper for the tries and helping me narrow it down to that part of line 5. Thanks to DuelingWarlord for helping me narrow it down to line 5.





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