Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Why won't this Body Gyro script work?

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....

ocal player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local bg = Instance.new("BodyGyro")
bg.maxTorque = Vector3.new(400000000, 400000000, 400000000)
bg.D = 200
bg.P = 3050
mouse.KeyDown:connect(function(key)
	if string.byte(key) == 48 then
		local torso = player.Character.Torso
		bg.Parent = torso
		debounce = true
	while debounce == true do
		bg.CFrame = CFrame.new(mouse.hit.p)
		print(bg.CFrame)
		wait()
	end
	end
end)
mouse.KeyUp:connect(function()
	debounce = false
	bg:remove()
end)

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

5 comments

0

Isn't like like shift lock?

0

well similar

0

Yeah, I turned my shift lock off to see if it works.

0

Please use UserInputService and test. KeyDown is deprecated and should not be used for future projects.

0

I haven't learned how to use "UserInputService" yet.... Plus what's wrong with KeyDown?

1 answer

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

This discussion is preserved as it was. New answers, comments, and votes are closed.