Davillion
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 853 |
|
|
| 19 Aug 2011 11:13 AM |
I am new to hopperbins, and I am trying to make a script that, when key 'a' is pushed, continues to rotate the turret until that key is lifted. Below I have posted my failed attempt... when I push key 'a,' the turret continues to rotate even after I lift the key. Could you please help :3
------
Sentry = Game.Workspace.Sentry
function onKeyDown(key) if key ~= nil then key = key:lower() while key == "a" do Sentry.Main.CFrame = Sentry.Main.CFrame * CFrame.fromEulerAnglesXYZ(0, math.rad(1), 0) wait() end end end
function onSelected(mouse) mouse.KeyDown:connect(onKeyDown) end
script.Parent.Selected:connect(onSelected)
|
|
|
| Report Abuse |
|
|
Davillion
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 853 |
|
| |
|
Davillion
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 853 |
|
| |
|
RoflBread
|
  |
| Joined: 18 Jun 2009 |
| Total Posts: 3803 |
|
|
| 19 Aug 2011 11:31 AM |
Hit the spy sappin' it :3
Looks like it should work to me, but then again, I'm no good with tool scripting D: |
|
|
| Report Abuse |
|
|
Davillion
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 853 |
|
|
| 19 Aug 2011 11:36 AM |
| Well, it doesn't work... When I lift the key it keeps going :-( Probably because the script gets stuck in that loop. |
|
|
| Report Abuse |
|
|
Davillion
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 853 |
|
|
| 19 Aug 2011 11:40 AM |
| I am becoming annoyed with my constant Bumps... |
|
|
| Report Abuse |
|
|
Davillion
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 853 |
|
|
| 19 Aug 2011 11:43 AM |
| I'm posting another thread -.- |
|
|
| Report Abuse |
|
|
|
| 19 Aug 2011 12:07 PM |
I personally do this. ------- local Keys = {} ---[[Stood here for connection line \/]]-- Mouse.KeyDown:connect(function(Key) if Key == "a" then Keys.a = true repeat wait() --[[What you want to happen when "a" is pressed]]-- until a == false end end) Mouse.KeyUp:connect(function(Key) if Key == "a" then Keys.a = false end end) |
|
|
| Report Abuse |
|
|
Davillion
|
  |
| Joined: 09 Dec 2008 |
| Total Posts: 853 |
|
| |
|