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

Why won't this Body Gyro script work?

Asked by 9 years ago

I wanted to make it so when you press 'Shift' it makes your Character face the Position of the Mouse... However, it won't do that and I have no clue as to why it won't work correctly... This script is a LocalScript inside of StarterGui....

01ocal player = game.Players.LocalPlayer
02local mouse = player:GetMouse()
03local bg = Instance.new("BodyGyro")
04bg.maxTorque = Vector3.new(400000000, 400000000, 400000000)
05bg.D = 200
06bg.P = 3050
07mouse.KeyDown:connect(function(key)
08    if string.byte(key) == 48 then
09        local torso = player.Character.Torso
10        bg.Parent = torso
11        debounce = true
12    while debounce == true do
13        bg.CFrame = CFrame.new(mouse.hit.p)
14        print(bg.CFrame)
15        wait()
View all 22 lines...

Thank you for reading the whole question and I hope someone can help me out!

0
Isn't like like shift lock? yoshi8080 445 — 9y
0
well similar yoshi8080 445 — 9y
0
Yeah, I turned my shift lock off to see if it works. KingLoneCat 2642 — 9y
0
Please use UserInputService and test. KeyDown is deprecated and should not be used for future projects. XAXA 1569 — 9y
0
I haven't learned how to use "UserInputService" yet.... Plus what's wrong with KeyDown? KingLoneCat 2642 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Make Sure That The Part That You Use To Move It With BodyGyro Did Not Anchored

Ad

Answer this question