|
| 11 May 2014 12:38 PM |
I have made a script to attempt to make an ASDF controls key mapping. So far I've only done the S key to walk "forward". The result is a very jerky and superhuman movement. Could anyone help? Here's my script that you need to see. The rest is under development for the other keys: repeat wait() until game.Players.LocalPlayer.Character wait(.1) Player = game.Players.LocalPlayer c = Player.Character x = Instance.new("Part") x.FormFactor = 3 x.Size = Vector3.new(1,1,1) x.TopSurface = "Smooth" x.BottomSurface = "Smooth" x.Reflectance = 0 x.Transparency = 0 x.BrickColor = BrickColor.new("Black") x.Parent = game.Workspace x.CanCollide = false w1 = Instance.new("Weld", c) w1.Part0 = w1.Parent["Torso"] w1.Part1 = x w1.C1 = CFrame.fromEulerAnglesXYZ(0,0,0) *CFrame.new(0,0,2)
Char = game.Players.LocalPlayer.Character Plyr = game.Players.LocalPlayer SKeyDown = nil DKeyDown = nil function SKey(key) if key == "s" then if SKeyDown == true then while SKeyDown == true do Char.Humanoid.AutoRotate = false wait(.1) Char.Humanoid.WalkToPoint(Vector3.new(x.Position)) w1 = Instance.new("Weld", c) w1.Part0 = w1.Parent["Torso"] w1.Part1 = x w1.C1 = CFrame.fromEulerAnglesXYZ(0,0,0) * CFrame.new(0,0,2) end Char.Humanoid.AutoRotate = true end end end
function SKeyCheckUp(key) if key == "s" then SKeyDown = false end end
function SKeyCheckDown(key) if key == "s" then SKeyDown = true end end
mouse = game.Players.LocalPlayer:GetMouse() mouse.KeyDown:connect(SKey) mouse.KeyUp:connect(SKeyCheckUp) mouse.KeyDown:connect(SKeyCheckDown) |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 12:53 PM |
| Use a Tween function, this makes the brick slide to that position rather than jumping directly to it. |
|
|
| Report Abuse |
|
|
Crakkitty
|
  |
| Joined: 25 Dec 2009 |
| Total Posts: 17408 |
|
|
| 11 May 2014 12:54 PM |
there's a tween function for models?
~nyaa~ |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:26 PM |
| How would I use a tween function to move the character? |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 May 2014 06:15 PM |
| tweening is vector2 specific |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 09:58 PM |
| So you can't tween models? |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 May 2014 10:23 PM |
| http://wiki.roblox.com/index.php?title=Lerp#Methods |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 May 2014 10:31 PM |
Char:MoveTo(Vector3:Lerp(x.Position, 1))
This returns an error code saying that Lerp is not a valid method even though the Wiki says that theoreticaly this should work. |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 10:33 PM |
Maybe its Char:Lerp (position,1) or w/e
Also..
Model:TranslateBy ()
:P |
|
|
| Report Abuse |
|
|
kubuto2
|
  |
| Joined: 16 Jul 2008 |
| Total Posts: 1275 |
|
|
| 11 May 2014 10:34 PM |
| Char:MoveTo(Char.Position:Lerp(x.Position, 1))--O god I hope x is a basepart. |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 10:49 PM |
| Well... You know, it kind of works... Only I'm superhuman again. |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 10:51 PM |
| Change 1 to a higher number.. |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 10:57 PM |
| A higher number? Alright, I'll try it. |
|
|
| Report Abuse |
|
|
| |
|