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 » Scripters
Home Search
 

Re: [Help] Change direction player is facing

Previous Thread :: Next Thread 
Stithos is not online. Stithos
Joined: 09 Apr 2014
Total Posts: 40
06 Apr 2015 12:52 AM
I am trying to make a script where you click and your player faces the spot that you clicked, but does not move.

I couldn't find anything on the wiki or forums. I made something that kinda works, but it's really buggy and i'm sure there is a better way to do it

game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 1
game.Players.LocalPlayer.Character.Humanoid.WalkToPoint = mouse.Hit.p
wait(0.25)
game.Players.LocalPlayer.Character.Humanoid.WalkSpeed = 16
game.Players.LocalPlayer.Character.Humanoid.WalkToPoint = game.Players.LocalPlayer.Character.Torso.Position

Any help is appriciated.
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
06 Apr 2015 12:59 AM
local players = game:GetService('Players')
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local mouse = player:GetMouse()
local UIS = game:GetService('UserInputService')

UIS.InputBegan:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
if mouse.Hit then
character.Humanoid:MoveTo(mouse.Hit.p)
end
end
end
end)
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
06 Apr 2015 01:00 AM
Oh

You said not move.

That changes a few things.
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
06 Apr 2015 01:01 AM
player.Character:WaitForChild("Torso").CFrame = CFrame.new(player.Character.Torso.Position,Vector3.new(mouse.hit.p.X,player.Character.Torso.Position.Y,mouse.hit.p.Z))


I script -~ chimmihc
Report Abuse
Stithos is not online. Stithos
Joined: 09 Apr 2014
Total Posts: 40
06 Apr 2015 01:05 AM
@chimmihc

Thanks!
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
06 Apr 2015 01:07 AM
--inspired by chimmihc

local players = game:GetService('Players')
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local mouse = player:GetMouse()
local UIS = game:GetService('UserInputService')

UIS.InputBegan:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
if mouse.Hit then
character.Torso.CFrame = CFrame.new(player.Character.Torso.Position, mouse.Hit.p)
end
end
end
end)
Report Abuse
chimmihc is not online. chimmihc
Joined: 01 Sep 2014
Total Posts: 17143
06 Apr 2015 01:09 AM
@amanda

You need to strip the Y axis or you can make your character facing down.


I script -~ chimmihc
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
06 Apr 2015 01:13 AM
i type faster than i read :(
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
06 Apr 2015 01:16 AM
local players = game:GetService('Players')
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:wait()
local mouse = player:GetMouse()
local UIS = game:GetService('UserInputService')

print(mouse.Hit.p)

UIS.InputBegan:connect(function(inputObject, gameProcessedEvent)
if not gameProcessedEvent then
if inputObject.UserInputType == Enum.UserInputType.MouseButton1 then
if mouse.Hit then
local hit = mouse.Hit
local torso = character.Torso
torso.CFrame = CFrame.new(torso.Position, Vector3.new(hit.X, torso.Position.Y, hit.Z))
end
end
end
end)
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
06 Apr 2015 01:20 AM
how my script progressed:

1. teleportation
2. walking to destination
3. swimming in the air
4. actually doing what it was suppose to do

didn't post teleportation because i figured it out early on
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
06 Apr 2015 01:47 AM
people like this

i really don't mind helping at all

people who are in it for a purpose, who want to get somewhere, who try

skill level doesn't matter

op is way above any guy who comes in here without trying to script and tries to bribe us into scripting something for them

which happens a lot more often then people who are polite and are trying to make something original and interesting
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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