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: Attempting to make an ASDF controls key mapping...

Previous Thread :: Next Thread 
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
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
blueboy112 is not online. blueboy112
Joined: 15 Apr 2009
Total Posts: 802
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 is not online. Crakkitty
Joined: 25 Dec 2009
Total Posts: 17408
11 May 2014 12:54 PM

there's a tween function for models?

~nyaa~
Report Abuse
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
11 May 2014 01:26 PM
How would I use a tween function to move the character?
Report Abuse
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
11 May 2014 06:13 PM
^
Report Abuse
JigglingJack is not online. JigglingJack
Joined: 25 Mar 2014
Total Posts: 11263
11 May 2014 06:15 PM
tweening is vector2 specific
Report Abuse
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
11 May 2014 09:58 PM
So you can't tween models?
Report Abuse
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
11 May 2014 10:17 PM
^
Report Abuse
secretidagent is not online. secretidagent
Joined: 07 Nov 2010
Total Posts: 1600
11 May 2014 10:23 PM
http://wiki.roblox.com/index.php?title=Lerp#Methods
Report Abuse
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
11 May 2014 10:27 PM
Thanks
Report Abuse
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
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
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
11 May 2014 10:33 PM
Maybe its
Char:Lerp (position,1)
or w/e

Also..

Model:TranslateBy ()

:P
Report Abuse
kubuto2 is not online. 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
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
11 May 2014 10:49 PM
Well... You know, it kind of works... Only I'm superhuman again.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
11 May 2014 10:51 PM
Change 1 to a higher number..
Report Abuse
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
11 May 2014 10:57 PM
A higher number? Alright, I'll try it.
Report Abuse
C0mmando323 is not online. C0mmando323
Joined: 15 Dec 2012
Total Posts: 394
11 May 2014 11:02 PM
Awesome, thanks!
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