177117
|
  |
| Joined: 17 May 2010 |
| Total Posts: 1366 |
|
|
| 28 Apr 2015 07:16 PM |
So I got this script
bin=script.Parent wait(.3) zombie = bin:findFirstChild("Horse")
function onButton1Down(mouse) local pos = mouse.hit.p local model = zombie:clone() model.Parent=game.Workspace model:MakeJoints() model:MoveTo(pos) end
function onSelected(mouse) mouse.Button1Down:connect(function () onButton1Down(mouse) end) end
bin.Selected:connect(onSelected)
And it spawns a horse when the player clicks an area. Although, I want it so that players can only spawn a horse every 60 seconds. How do I achieve this? |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 28 Apr 2015 07:20 PM |
local waiting = false bin=script.Parent wait(.3) zombie = bin:findFirstChild("Horse")
function onButton1Down(mouse) local pos = mouse.hit.p local model = zombie:clone() model.Parent=game.Workspace model:MakeJoints() model:MoveTo(pos) end
function onSelected(mouse) mouse.Button1Down:connect(function () if not waiting then waiting = true onButton1Down(mouse) wait(60) waiting = false end end) end
bin.Selected:connect(onSelected) |
|
|
| Report Abuse |
|
|
177117
|
  |
| Joined: 17 May 2010 |
| Total Posts: 1366 |
|
|
| 28 Apr 2015 07:21 PM |
| Thank you so much! You made my day! |
|
|
| Report Abuse |
|
|
| |
|
NotAshley
|
  |
| Joined: 16 Jan 2014 |
| Total Posts: 14257 |
|
|
| 28 Apr 2015 07:29 PM |
| This isn't really advanced. |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2015 07:47 PM |
I cannot tell a lie, fish "Fish" actually made me laugh there.
~R.I.P ROBLOX: http://www.roblox.com/Firefighter-Helmet-item?id=1081377 ~ |
|
|
| Report Abuse |
|
|
|
| 28 Apr 2015 07:52 PM |
Actually... This leave the thread open to waiting which is more cumbersome than...
local delay = 60 local last_time = tick()
function onClick() local cur_time = tick() if(cur_time % 60 > last_time+delay)then --safe to execute end last_time = cur_time end |
|
|
| Report Abuse |
|
|