Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

BodyGyro How Turn Left, Right Instantly On Key Press?

Asked by 6 years ago
Edited 6 years ago

I'm trying to turn the character left instantly when pressed A and turned right instantly when pressed D. Everything except the turning left or right works. It does print out debug when keys pressed.

01local plr = game:GetService("Players").LocalPlayer
02local char = plr.Character or plr.CharacterAdded:Wait()
03local rootpart = char:WaitForChild('HumanoidRootPart')
04local humanoid = game:GetService("Players").LocalPlayer.Character.Humanoid
05    humanoid.AutoRotate = false
06 
07 
08    BodyGyro = Instance.new('BodyGyro')
09    BodyGyro.Name = 'Turning'
10    BodyGyro.Parent = rootpart
11    BodyGyro.P = 10000
12    BodyGyro.D = 1000
13 
14game:GetService("UserInputService").InputBegan:connect(function(input)
15    if input.KeyCode == Enum.KeyCode.D then
View all 26 lines...
0
What script you use and where did you put it? HeyItzDanniee 252 — 6y
1
LocalScript and in StarterPack kaspar1230 345 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

If you want it to be instant there is no need to use a body gyro, you can change it instantly using CFrame or (I would not suggest this) Orientation.

You can find out more about CFrame here:

http://wiki.roblox.com/index.php?title=CFrame

Ad

Answer this question