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: What went wrong?

Previous Thread :: Next Thread 
3rdblox is not online. 3rdblox
Joined: 09 Dec 2012
Total Posts: 4741
01 May 2013 02:48 PM
I've tried to make a button that gives the toucher 1,000 Cash when it's touched, then kill the toucher. But it's not working. Here's my script.
X = 1000 --Note to self: Change X to however much cash you want this button to give.
function addcash(toucher)
local character = toucher.Parent
local check = charachter.findFirstChild("Humanoid")
if check ~= nil then
if check.Health.Value >0 then
local player = charachter.getPlayerFromCharachter()
if player ~= nil then
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + X
charachter.Humanoid.Health.Value = 0
end
end
end
end
script.Parent.Touched:connect(addcash)

And here's my output from when I touched the button

20:45:09.940 - Workspace.Part.Script:4: attempt to index global 'charachter' (a nil value)
20:45:09.942 - Script "Workspace.Part.Script", Line 4
20:45:09.943 - stack end
20:45:09.943 - Disconnected event because of exception

How do I fix my script?
Report Abuse
getkoed2 is not online. getkoed2
Joined: 11 Apr 2010
Total Posts: 1144
01 May 2013 02:57 PM
If you have also read the output, you know it's character and not charachter. ._.

local check = character:findFirstChild("Humanoid")
Report Abuse
129K is not online. 129K
Joined: 23 Aug 2011
Total Posts: 19010
01 May 2013 02:57 PM
You misspelled "character."
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