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

Previous Thread :: Next Thread 
jojods1125 is not online. jojods1125
Joined: 27 Sep 2011
Total Posts: 11253
01 Apr 2014 07:35 AM
I'm making it so when someone opens up a GUI, a certain ImageButton will have different images depending on whether or not you own an item. I got the open/close script to work, but not the PlayerOwnsAsset script. Here's the Explorer window:

StarterGui
--ArrowGUI (Frame)
----Arrows (Frame inside ArrowGUI)
----BlueFrame (Same as Arrows)
------Page1 (Frame inside BlueFrame)
--------Pic1 (ImageButton inside Page1)
----OpenClose (Frame inside ArrowGUI)
------Open (Textbutton inside OpenClose)
--------Script (Script in Open)


Here's the script:


Pic1 = script.Parent.Parent.Parent.BlueFrame.Page1.Pic1

script.Parent.MouseButton1Down:connect(function(plr)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,151625745) then
Pic1.Image = "rbxassetid://151594398"
else
Pic1.Image = "rbxassetid://151169783"
end
end)



Does anyone know what's wrong? Thanks!
Report Abuse
vlekje513 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
01 Apr 2014 07:42 AM
You didn't define plr.
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
01 Apr 2014 08:37 AM
local plr = game.Players.LocalPlayer
Report Abuse
jojods1125 is not online. jojods1125
Joined: 27 Sep 2011
Total Posts: 11253
02 Apr 2014 07:34 AM
I changed it to a LocalScript, and it now looks like this:

Pic1 = script.Parent.Parent.Parent.BlueFrame.Page1.Pic1
local plr = game.Players.LocalPlayer

script.Parent.MouseButton1Down:connect(function(plr)
if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,151625745) then
Pic1.Image = "rbxassetid://151594398"
else
Pic1.Image = "rbxassetid://151169783"
end
end)


Still doesn't work. Anything else that's wrong?
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