|
| 19 Apr 2012 07:40 PM |
mdl = script.Parent.Parent
local ting = 0 --debouncer
function onTouched(hit)
if ting == 0 then --debounce check ting = 1 --activate debounce check = hit.Parent:FindFirstChild("Humanoid") --Find the human that touched the button
if check ~= nil then --If a human is found, then
local user = game.Players:GetPlayerFromCharacter(hit.Parent) --get player from touching human local stats = user:findFirstChild("leaderstats") --Find moneyholder
if stats ~= nil then --If moneyholder exists then local cash = stats:findFirstChild("Money") --Get money cash.Value = cash.Value +250 --increase amount of money by the number displayed here (500) check.Health = "0" --kills noob so he can't keep claiming money script.Parent.Transparency = "0.5" --shows the player it is inactive by changing reflectancy mdl.Name = "+250 (5 Seconds until active)" --changes the name, it will be displayed above the brick wait(1) --wait-time before button works again mdl.Name = "+250 (4 Seconds until active)" --changes the name, it will be displayed above the brick wait(1) --still waiting mdl.Name = "+250 (3 Seconds until active)" --changes the name, it will be displayed above the brick wait(1) --still waiting mdl.Name = "+250 (2 Seconds until active)" --changes the name, it will be displayed above the brick wait(1) --still waiting mdl.Name = "+250 (1 Second until active)" --changes the name, it will be displayed above the brick wait(1) --still waiting script.Parent.Transparency = "0" --reverts reflectancy mdl.Name = "+250 (5 second cooldown)" --changes back to original name end
end
ting = 0 --remove debounce end
end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2012 07:41 PM |
What's with all the comments?
† KMXD † |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2012 07:46 PM |
| Open-sourced it for one of my friends who's trying to understand how I did it, we're both lua noobs. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 19 Apr 2012 08:22 PM |
I doubt that's your first script.
My first script was this.
game.Workspace.miz656.Head:Destroy()
And that's only one line. |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2012 08:37 PM |
| Well I've done that, but I didn't consider that a script, I mean something someone else could find useful perhaps. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 19 Apr 2012 08:38 PM |
| That code could be VERY useful. Image you want a loopkill. You could use that piece of script to combine with another script. |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2012 08:40 PM |
| I understand, but that sole line alone isn't what I would consider to be a full script. I've done things like that, or changing decals over a period of time, or transparency, cancolide, ect. |
|
|
| Report Abuse |
|
|
mage11561
|
  |
| Joined: 03 Sep 2008 |
| Total Posts: 13217 |
|
|
| 19 Apr 2012 08:40 PM |
| why do i feel that i've seen this on a tutorial before as a sample script. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 19 Apr 2012 08:41 PM |
@mage
You had.
It's just I hadn't :)
Still, it's a script. |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2012 08:42 PM |
| Probably because I based it off a script that gave you money on touch, except I added a cooldown, transparency, and name changes, as well as death. |
|
|
| Report Abuse |
|
|
|
| 19 Apr 2012 08:43 PM |
Well if you're adding things, you technically didn't make it (by yourself), but it's still pretty good.
† KMXD † |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
|
| 19 Apr 2012 08:45 PM |
| I didn't add things, I just looked at things from other scripts, then added -- to make notes of what I was doing. Well, okay, I guess that's the same thing. Thanks anyways. I'm just trying to figure out all the variables. Next I'm trying to learn is velocity. |
|
|
| Report Abuse |
|
|