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: LocalScript to Workspace Communication

Previous Thread :: Next Thread 
16KakashiN is not online. 16KakashiN
Joined: 20 Jul 2010
Total Posts: 53
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
LilJoker4675 is not online. LilJoker4675
Joined: 31 Oct 2011
Total Posts: 220
04 Feb 2014 09:32 PM
So your trying to do a keyboard function?
Report Abuse
lolb3 is not online. 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 is not online. travddm
Joined: 29 Mar 2012
Total Posts: 926
04 Feb 2014 09:48 PM
http://wiki.roblox.com/index.php?title=RemoteFunction
Report Abuse
Andrew1234567mmm is not online. Andrew1234567mmm
Joined: 14 Oct 2009
Total Posts: 691
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 is not online. 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 is not online. travddm
Joined: 29 Mar 2012
Total Posts: 926
04 Feb 2014 09:52 PM
@above Stop criticizing.
Report Abuse
jonesj627 is not online. 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 is not online. 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 is not online. 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 is not online. travddm
Joined: 29 Mar 2012
Total Posts: 926
04 Feb 2014 09:54 PM
Mouse is still defined incorrectly. e,e
Report Abuse
lolb3 is not online. 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
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