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: Im making a item buyer but....

Previous Thread :: Next Thread 
DragonFox11 is not online. DragonFox11
Joined: 15 Nov 2013
Total Posts: 284
16 Feb 2014 07:37 AM
ok want it to subtract money(lederboard stats) from this

price = script.Parent.Parent.Price.Value
local debounce = true
function onTouched(part)
local h = part.Parent:FindFirstChild("Humanoid")
if game.Players[h.Parent.Name].Value.Value < price then return end
if debounce == true then
debounce = false
game.Players[h.Parent.Name].Value.Value = game.Players[h.Parent.Name].Value.Value - price
a = game.Lighting[script.Parent.Parent.Product.Value]:Clone()
a.Parent = game.Players[h.Parent.Name].Backpack
wait(4)
debounce = true
end
end
script.Parent.Touched:connect(onTouched)

actually can someone help me? the item is in lighting but it wont spawn in backpack
Report Abuse
DragonFox11 is not online. DragonFox11
Joined: 15 Nov 2013
Total Posts: 284
16 Feb 2014 07:40 AM
bump
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
16 Feb 2014 07:43 AM
price = script.Parent.Parent.Price.Value
local debounce = true
script.Parent.Touched:connect(function(part)
local h = part.Parent:FindFirstChild("Humanoid")
if h then
plr = game.Players:GetPlayerFromCharacter(part.Parent)
if debounce == true then
debounce = false
if (plr.leaderstats.LeaderStatNameHere.Value >= price) then
plr.leaderstats.LeaderStatNameHere.Value = plr.leaderstats.LeaderStatNameHere.Value - price
a = game.Lighting[script.Parent.Parent.Product.Value]:Clone()
a.Parent = plr.Backpack
wait(4)
debounce = true
end
end
end
end)


~The G
Report Abuse
DragonFox11 is not online. DragonFox11
Joined: 15 Nov 2013
Total Posts: 284
16 Feb 2014 07:48 AM
Thank you
Report Abuse
shawnyg is not online. shawnyg
Joined: 21 Apr 2011
Total Posts: 1428
16 Feb 2014 07:49 AM
No problem. Instead of trying to find the child in players, you should use the GetPlayerFromCharacter method.

~The G
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