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

My rotation script based on humanoid root part doesn't seem to work?

Asked by 4 years ago
Edited 4 years ago

I've been trying to make a motion detector and so far it's gone pretty well. I've recently been working on rotating the part to match the player's rootpart direction, but I just can't seem to get the script to work. The only thing the output says is "Workspace.player.Tool.Handle.Part.SurfaceGui.Background.Rotate,Line 8" The part that I'm scripting is inside a tool, so that may be a problem.

local player = game:GetService("Players").LocalPlayer
local part1 = player.Character.HumanoidRootPart
local direction = part1.CFrame.lookVector
local heading = math.atan2(direction.x, direction.z)
local head = math.deg(heading)

while true do
    script.Parent.Rotation = script.Parent.Rotation + UDim2.new(head)
    wait()
end
0
maybe rotate the torso Kittymuffin323 -10 — 4y
0
What do you mean by that? Boomboyag 14 — 4y

Answer this question