|
| 05 Apr 2014 08:30 AM |
This is part of a script to give the player an item they bought by cloning that item from serverstorage.
However, this doesn't work. Can anyone see why? for i,v in pairs (game.Players:GetChildren()) do if v.userId == receiptInfo.PlayerId then if receiptInfo.ProductId == PASSID then backpack = v:FindFirstChild("Backpack") pass = game.ServerStorage.Pass:Clone() pass.parent = backpack end
Thanks, MD |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 08:43 AM |
| The script has an elseif that awards points instead of items and this part works so the code behind the purchasing isn't the problem. |
|
|
| Report Abuse |
|
|
Perci1
|
  |
| Joined: 24 Jan 2011 |
| Total Posts: 1027 |
|
|
| 05 Apr 2014 08:57 AM |
for i,v in pairs (game.Players:GetChildren()) do --Change to :GetPlayers() if v.userId == receiptInfo.PlayerId then --receiptInfo? You need to state all the hierarchy, or make a variable.
if receiptInfo.ProductId == PASSID then
backpack = v:FindFirstChild("Backpack") pass = game.ServerStorage.Pass:Clone() pass.parent = backpack --Parent should be capital
end --Add another end --Add another end
|
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 09:00 AM |
| Thanks! It was that uncapitalised parent that was the reason it didn't work! |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 09:01 AM |
for i,v in pairs (game.Players:GetChildren()) do if v.userId == receiptInfo.PlayerId then
if receiptInfo.ProductId == PASSID then
backpack = v:FindFirstChild("Backpack") pass = game.ServerStorage.Pass:Clone() pass.Parent = backpack end end end |
|
|
| Report Abuse |
|
|