|
| 04 Feb 2014 09:28 PM |
I've been working for an hour now, and I'm still not any closer to accomplishing what I set out to do...
Anyway, on with my problem. I have a LocalScript that I have to detect key inputs and stores them to a table. I've been trying to get it so while a certain key is pressed, a block in the workspace is moved a specific distance in a given direction. My problem occurs when I try to take that keyboard input from the LocalScript so it has some sort of effect on Workspace, since LocalScripts cannot affect anything outside of the client.
What would be the best way of translating the key press to the workspace? I apologize if this seems a pretty basic question, but I've just started scripting, and cannot find a related answer anywhere I look online.
Thanks for your time. |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2014 09:32 PM |
| So your trying to do a keyboard function? |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 04 Feb 2014 09:45 PM |
since when can localscripts not affect anything non-client?
mouse = game.Players.LocalPlayer
keydown = false
mouse.KeyDown:connect(function(key) if key == "w" then keydown = true
repeat part.CFrame = part.CFrame + CFrame.new(0,0,1) wait() until keydown = false end ebd)
mouse.KeyUp:connect(function(key) if key == "w" then keydown = fakse end end) |
|
|
| Report Abuse |
|
|
travddm
|
  |
| Joined: 29 Mar 2012 |
| Total Posts: 926 |
|
|
| 04 Feb 2014 09:48 PM |
| http://wiki.roblox.com/index.php?title=RemoteFunction |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2014 09:50 PM |
@lolb
No just no learn scripting before coming here. I'm sorry to be harsh but seriously
Mouse = game.Players.LocalPlayer:GetMouse()
Not Mouse = game.Players.LocalPlayer
What's the matter with you |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 04 Feb 2014 09:52 PM |
| Rather harsh considering it'd late. I composed the script myself within the cruddy confines of the ROBLOX forum post editor. Get your critiquing butt out of SH because you yourself didn't compose a script, whereas I did. It works aside from the fact that I forgot to actually find the mouse. |
|
|
| Report Abuse |
|
|
travddm
|
  |
| Joined: 29 Mar 2012 |
| Total Posts: 926 |
|
| |
|
jonesj627
|
  |
| Joined: 06 Oct 2010 |
| Total Posts: 1496 |
|
|
| 04 Feb 2014 09:52 PM |
| I agree with lolb, you didn't have to make the comments, he made a mistake, everyone does. |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 04 Feb 2014 09:53 PM |
Honestly how hard is it to point out I forgot to get the mouse? I just fixed a few syntax errors as well.
mouse = game.Players.LocalPlayer
keydown = false
mouse.KeyDown:connect(function(key) if key == "w" then keydown = true repeat part.CFrame = part.CFrame + CFrame.new(0,0,1) wait() until keydown = false end ebd)
mouse.KeyUp:connect(function(key) if key == "w" then keydown = false end end) |
|
|
| Report Abuse |
|
|
travddm
|
  |
| Joined: 29 Mar 2012 |
| Total Posts: 926 |
|
|
| 04 Feb 2014 09:53 PM |
| Oh my god.. Ninja post. My last post was at Andrew. |
|
|
| Report Abuse |
|
|
travddm
|
  |
| Joined: 29 Mar 2012 |
| Total Posts: 926 |
|
|
| 04 Feb 2014 09:54 PM |
| Mouse is still defined incorrectly. e,e |
|
|
| Report Abuse |
|
|
lolb3
|
  |
| Joined: 16 Jan 2010 |
| Total Posts: 2268 |
|
|
| 04 Feb 2014 10:09 PM |
i have to pee and the bathroom's occupied lol
mouse = game.Players.LocalPlayer:GetMouse()
keydown = false
mouse.KeyDown:connect(function(key) if key == "w" then keydown = true repeat part.CFrame = part.CFrame + CFrame.new(0,0,1) wait() until keydown = false end ebd)
mouse.KeyUp:connect(function(key) if key == "w" then keydown = false end end)
|
|
|
| Report Abuse |
|
|