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: Why isnt this working/ NEED HELP

Previous Thread :: Next Thread 
dizzywaffle is not online. dizzywaffle
Joined: 13 Jun 2011
Total Posts: 3075
07 Aug 2013 07:48 AM
print("Shop Script Loaded")

Door = script.Parent
local debounce = false

function getPlayer(humanoid)
local players = game.Players:children()
for i = 1, #players do
if players[i].Character.Humanoid == humanoid then return players[i] end
end
return nil
end
function onTouched(hit)
if debounce == false then
local human = hit.Parent:findFirstChild("Humanoid")
if (human == nil) then return end
local player = getPlayer(human)
debounce = true
if (player == nil) then return end
local stats = player:findFirstChild("leaderstats")
local sp = stats:findFirstChild("Points") --Change "Money" to the type of currency you have.
if sp == nil then return false end
if (sp.Value >=450) then --Amount of how much the weapon will go for,Change "100".
sp.Value = sp.Value - 450 --Put the same exact number here as you did above.
print("Enough Money")
game.Lighting.Blade:clone().Parent = player.StarterPack
Door.BrickColor = BrickColor.new(21) --MAKE SURE YOU PUT THE WEAPON/TOOL INTO LIGHTING.
wait(2)
Door.BrickColor = BrickColor.new(37) --Leave the rest of this alone.
debounce = false
else debounce = false
end
end

end

connection = Door.Touched:connect(onTouched)
Report Abuse
dizzywaffle is not online. dizzywaffle
Joined: 13 Jun 2011
Total Posts: 3075
07 Aug 2013 07:49 AM
B1
Report Abuse
Desperian is not online. Desperian
Joined: 07 Feb 2012
Total Posts: 3371
07 Aug 2013 07:50 AM
"Don't ask others to debug your broken code without giving a hint what sort of problem you are having. Posting a few hundred lines of code, saying "it doesn't work", will get you ignored. Posting a dozen lines of code, saying "after line 7 I was expecting to see (something), but (something else) happened instead" is much more likely to get you a reply."

---

1) You do realise there's a ':GetPlayerFromCharacter()' method?
2) You don't need to bump a thread, when it's one of the top threads.
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