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: Sentry

Previous Thread :: Next Thread 
Davillion is not online. 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 is not online. Davillion
Joined: 09 Dec 2008
Total Posts: 853
19 Aug 2011 11:17 AM
BUMP Please help :-)
Report Abuse
Davillion is not online. Davillion
Joined: 09 Dec 2008
Total Posts: 853
19 Aug 2011 11:26 AM
z0mg help pl0x
Report Abuse
RoflBread is not online. 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 is not online. 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 is not online. 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 is not online. Davillion
Joined: 09 Dec 2008
Total Posts: 853
19 Aug 2011 11:43 AM
I'm posting another thread -.-
Report Abuse
SpleenYanks is not online. SpleenYanks
Joined: 24 Aug 2008
Total Posts: 921
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 is not online. Davillion
Joined: 09 Dec 2008
Total Posts: 853
19 Aug 2011 03:34 PM
Well thank you. :D
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