Hi, So basically, I’m trying to make the player’s character face in the direction of the mouse… But…
Once I die/reset, it stops working, but the event still fires…? How???
local runservice = game:GetService("RunService")
local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Root = character.PrimaryPart
local mouse = player:GetMouse()
local event = game:GetService("ReplicatedStorage"):WaitForChild("BodyToMouseCFrameEvent")
runservice.RenderStepped:Connect(function()
event:FireServer(math.asin(mouse.Hit.LookVector.Y),character.Humanoid.RigType)
if character:FindFirstChild("HumanoidRootPart") then
character:SetPrimaryPartCFrame(CFrame.new(character.HumanoidRootPart.CFrame.p, character.HumanoidRootPart.CFrame.p + Vector3.new(mouse.Hit.LookVector.X * 100, 0, mouse.Hit.LookVector.Z * 100)))
end
end)
(its a local script if you couldn’t tell!)
Oh, and it DEFINITELY has the humanoidrootpart, because when I hooked up an error message to the else from the if character:FindFirstChild("HumanoidRootPart") then
, the error didn’t fire.