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: Cloning an item from serverstorage

Previous Thread :: Next Thread 
MasterDaniel is not online. MasterDaniel
Joined: 28 Nov 2008
Total Posts: 2866
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
MasterDaniel is not online. MasterDaniel
Joined: 28 Nov 2008
Total Posts: 2866
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 is not online. 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
MasterDaniel is not online. MasterDaniel
Joined: 28 Nov 2008
Total Posts: 2866
05 Apr 2014 09:00 AM
Thanks! It was that uncapitalised parent that was the reason it didn't work!
Report Abuse
McChicken72 is not online. McChicken72
Joined: 09 Feb 2013
Total Posts: 1115
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
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