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
|
  |
| 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
|
  |
| Joined: 23 Aug 2011 |
| Total Posts: 19010 |
|
|
| 01 May 2013 02:57 PM |
| You misspelled "character." |
|
|
| Report Abuse |
|
|