|
| 19 Aug 2013 02:26 PM |
I'm trying to learn to script but it's just not working I just wont understand a thing from the wiki. Well I understand a couple of things but not what I want to learn, I want to learn how to use onKeydown functions etc, and connect them with gui's, does anyone have any idea where or how I could learn it? Help appriciated!
(I'm not English btw, I'm French and Dutch) |
|
|
| Report Abuse |
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 19 Aug 2013 02:27 PM |
Been there done that. Example: function userInput() local playert = game.Players.LocalPlayer local mouse = playert:GetMouse() local move = playert.PlayerGui.Main.Level.Player local KeyPress local Keys = {["w"] = true , ["a"] = true, ["s"] = true, ["d"] = true} mouse.KeyDown:connect(function(key) KeyPress = true while KeyPress and Keys[key] and Wait(0.1) do if key:lower() == "w" then move.Position = move.Position + UDim2.new(0, 0, 0, -16) elseif key:lower() == "s" then move.Position = move.Position + UDim2.new(0, 0, 0, 16) elseif key:lower() == "a"then move.Position = move.Position + UDim2.new(0, -16, 0, 0) elseif key:lower() == "d" then move.Position = move.Position + UDim2.new(0, 16, 0, 0) end end end) mouse.KeyUp:connect(function(key) if Keys[key] then KeyPress = false end end) end
You're welcome :) |
|
|
| Report Abuse |
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
|
| 19 Aug 2013 02:29 PM |
Here is the full script.
http://www.roblox.com/free-item?id=127072609 |
|
|
| Report Abuse |
|
BruceAB12
|
  |
| Joined: 19 Jan 2012 |
| Total Posts: 3238 |
|
| |