When The player looks at a part the player snaps

heres my script

	humanoid.WalkToPoint = game.Workspace.Small.GOTO.Position
	
	wait(0.4)
	
	local lookpart = game.Workspace.Small
		local RS = game:GetService("RunService")
	local plr = game.Players.LocalPlayer


		if plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
			plr.Character.HumanoidRootPart.CFrame = CFrame.new(plr.Character.HumanoidRootPart.CFrame.Position, lookpart.Position)
		end

the problem is that when the lookat part of the script happens the player just snaps thus making it not that good, i want it to be smooth , the script works right now BUT the only prblem is the snapping

test the script if you need

1 Like

Try tweening the orientation of the HumanoidRootPart using CFrame.

1 Like

You will need to tween the CFrame to make it look smooth. Here we go, there’s your example code.

local TS = game:GetService("TweenService")

humanoid.WalkToPoint = game.Workspace.Small.GOTO.Position
	
wait(0.4)
	
local lookpart = game.Workspace.Small
local RS = game:GetService("RunService")
local plr = game.Players.LocalPlayer


if plr.Character and plr.Character:FindFirstChild("HumanoidRootPart") then
	TS:Create(Character.HumanoidRootPart, TweenInfo.new(.5), {["CFrame"] = CFrame.new(plr.Character.HumanoidRootPart.CFrame.Position, lookpart.Position)}):Play()
end
2 Likes

it says

Players.adoptmebaddyEgirl.PlayerScripts.SmallLocal:29: Expected ‘)’ (to close ‘(’ at column 84), got '}

Edited my post, try copying it again

1 Like

never mind i fixed it lol, just put )})

sorry for the late response, but now its not working as intended , or in other words its not how it used to be, i just wanted it to be exactly as it was but not snapping , now its completly different, ill try some other methods and go back to you

You can adjust it however you want. Read about TweenService: TweenService | Documentation - Roblox Creator Hub

the quickest response you will ever see, anyways i did some adjustments with the script and it did work thank you very much

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.