llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
|
| 23 Feb 2015 11:10 AM |
local id = 219566324
script.Parent.MouseButton1Down:connect(function(plr) game:GetService("MarketplaceService"):PromptPurchase(plr, id) end)
Output
>Unable to cast value to object |
|
|
| Report Abuse |
|
|
|
| 23 Feb 2015 11:14 AM |
| value object is plr, plr isn't the player. |
|
|
| Report Abuse |
|
|
llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
| |
|
llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
| |
|
SLY3
|
  |
| Joined: 10 Jul 2008 |
| Total Posts: 1700 |
|
|
| 23 Feb 2015 11:20 AM |
The 'plr' variable doesn't get defined as the player, it gets defined as a position coordinate of the player's mouse when they clicked it.
If this is a local script, just use local plr = game.Players.LocalPlayer,
if it's not, just do local plr = script.Parent.Parent.Parent (ect) |
|
|
| Report Abuse |
|
|
llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
| |
|
|
| 23 Feb 2015 11:21 AM |
Last I recall you are getting the Character not the Player
:GetPlayerFromCharacter()
Give me 15 Robux I give you print("Give me 15k") |
|
|
| Report Abuse |
|
|
llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
|
| 23 Feb 2015 11:23 AM |
Im not very sure how to change it but i did this but it still doesnt work local id = 219570828 local plr = script.Parent.Parent.Parent.Parent script.Parent.MouseButton1Down:connect(function(plr) game:GetService("MarketplaceService"):PromptPurchase(plr, id) end) |
|
|
| Report Abuse |
|
|
llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
| |
|
llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
| |
|
llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
| |
|
llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
| |
|
llcoolj03
|
  |
| Joined: 20 Nov 2011 |
| Total Posts: 6135 |
|
| |
|
|
| 23 Feb 2015 12:14 PM |
*sigh...*
local player = game.Players.LocalPlayer local id = 219566324
script.Parent.MouseButton1Down:connect(function() game:GetService("MarketplaceService"):PromptPurchase(plr,id) end) |
|
|
| Report Abuse |
|
|
Dr01d3k4
|
  |
| Joined: 11 Oct 2007 |
| Total Posts: 17916 |
|
|
| 23 Feb 2015 12:14 PM |
| Is this in a gui? The parameters to the function for MouseButton1Down are x and y locations of mouse, not the player. |
|
|
| Report Abuse |
|
|