robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 15 Jun 2013 05:08 PM |
player.Character.Torso.CFrame = player.Character.Torso.CFrame*CFrame.new(0,0,5)
how i make it instead of moving to the front of torso move to where my mouse aims(NOT TELEPORT, JUST MOVE) |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 15 Jun 2013 05:12 PM |
btw, im running this script with Key Down, not Mouse Click its when u hold F |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
| |
|
|
| 15 Jun 2013 05:29 PM |
I just made this, it is untested, but take a look. It will move the characters torso a fraction given by speed but if that fraction is slower then the minimum distance then it will move it by the minimum distance. The maximum distance is what you think it is, the maximum distance to move each Update(). If the distance between the mouse and the torso is less then the minimum distance then it just moves the torso to the mouse. Frequency is the wait time between when Update() is called.
Enjoy!
--------------------------------------------------------
local mouse = --THE MOUSE local torso = --THE PLAYER'S TORSO
mouse.TargetFilter = torso --IMPORTANT, so it doesn't fly into camera.
local MinDist = 1 -- Bigger = faster in some cases, but never slower local MaxDist = 3 -- Bigger = faster in some cases, but never slower local Speed = 10 --1 = MAX SPEED, bigger = slower local Frequency = 0.1 -- nil = MAX SPEED, number between 0 and 1, bigger number = slower, 0 = game crash
local function Update() local delta = Torso.Position - mouse.Hit.p if delta.magitude > MinDist = then delta = delta/Speed if delta.magitude < MinDist then delta = delta.unit * MinDist elseif delta.magnitude > MaxDist then delta = delta.unit * MaxDist end end Torso.CFrame = Torso.CFrame + delta end
while wait(Frequency) do Update() end
|
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 15 Jun 2013 05:36 PM |
@Aribter didnt work. and stop posting that script, im just asking for one line in help |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2013 05:41 PM |
| First off, that was a rude response for how much time I put into that script to help you. Second, To MOVE an object, you need to TELEPORT it small steps OVER TIME. That is what my script does. It is not a one line problem. As I said, it is untested. I can help you test it so that you can be on your way, just post the output. |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 15 Jun 2013 05:45 PM |
| im already using a loop, i dont need a lot of coding. i just want my torso to aim where my mouse is pointing to, so then i can move character by typing player.Character.Torso.CFrame = player.Character.Torso.CFrame.lookVector*speed |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2013 05:57 PM |
Ah, okay. Try this:
-------------------------------
local Torso = player.Character.Torso.CFrame
local Position = Torso.Position local LookAt = mouse.Hit.p
Torso.CFrame = CFrame.new(Position, LookAt)
-------------------------------
Here is the explanation of that overloaded version of new: http://wiki.roblox.com/index.php/Cframe |
|
|
| Report Abuse |
|
|
777MrEpic
|
  |
| Joined: 17 Oct 2012 |
| Total Posts: 3998 |
|
|
| 15 Jun 2013 05:58 PM |
posted 4 minutes after mine and I still dont have a response :'( |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 15 Jun 2013 06:02 PM |
i got this now.
player.Character.Torso.CFrame = CFrame.new(player.Character.Torso.Position, mouse.Hit.p)
but it doesnt go where my mouse is, if my mouse looks at front, char moves to back, if mouse look at left, char moves to right, if mouse at back, moves to frnot, btw doesnt go up |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
| |
|
|
| 15 Jun 2013 06:11 PM |
I understand. Sorry that I didn't come, I was helping someone else. Use this code instead, it turns the CFrame around by 180 degrees, a half turn, facing the opposite direction.
player.Character.Torso.CFrame = CFrame.new(player.Character.Torso.Position, mouse.Hit.p) * CFrame.angles(0,math.pi,0) |
|
|
| Report Abuse |
|
|
robotmega
|
  |
| Joined: 16 May 2009 |
| Total Posts: 14084 |
|
|
| 15 Jun 2013 06:16 PM |
if i put mouse in character torso, it moves slow if i put it between char and map, it moves super slow if i put it at the sky, it doesnt moves |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2013 06:39 PM |
| Are you using my script above? I believe my script above should move you at 10 studs a second if you used it. If it is your script, then I don't know what could cause it. |
|
|
| Report Abuse |
|
|
|
| 15 Jun 2013 07:29 PM |
-- i haven't tested this, but i suppose it may serve as a proof of concept
local velocity = 1 -- velocity in studs per second
local holding = false local Torso = game.Players.LocalPlayer.Torso
function MoveWhileHolding() -- to interrupt the process, simply set the value of 'holding' to false holding = true while holding do Torso.CFrame = CFrame.new(Torso.Position, mouse.Hit.p) * CFrame.new(0, 0, -wait() * velocity) end end
MoveWhileHolding() wait(3) holding = false |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 15 Jun 2013 08:04 PM |
Just to note:
mouse.hit (CFrame) moue.hit.p (Vector3) |
|
|
| Report Abuse |
|
|