Player Not Rotating in Animation

Hi! I’m trying to make a script where while you’re holding the proximity prompt, you’re doing an animation. But when I do it, I don’t face the window.
I tried doing the rotation and setting the y rotation to 90, and that didn’t work. Neither did anything else.
AND YES I CHECKED THE FORUMS.


Here’s the script (without rotation):

local prompt = game.Workspace.ProximityPromptJumpingThroughWindow.ProximityPrompt
local animation = script.Animation

prompt.PromptButtonHoldBegan:Connect(function(player)
	if player.Character:FindFirstChild("HumanoidRootPart") then
		
		player.Character.Torso.CanCollide = false
		player.Character.Humanoid.WalkSpeed = 0
		local hum = player.Character.Humanoid
		local loadanim = hum.Animator:LoadAnimation(animation)
		
		player.Character:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(-1122.589, 158.136, 445.214)
		loadanim:Play()
	end
end)

prompt.Triggered:Connect(function(player)
	if player.Character:FindFirstChild("HumanoidRootPart") then
		player.Character:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.TeleportRUN.Teleportto.CFrame
		
		game.Workspace.TeleportRUN.Teleportto.CanTouch = false
		
		wait(3)
		
		game.Workspace.TeleportRUN.Teleportto.CanTouch = true
	end
end)

prompt.PromptButtonHoldEnded:Connect(function(player)
	if player.Character:FindFirstChild("HumanoidRootPart") then
		player.Character.Humanoid.WalkSpeed = 16
		local hum = player.Character.Humanoid
		
		local loadanim = hum.Animator:GetPlayingAnimationTracks(animation)
		for i, track in pairs (loadanim) do
			track:Stop()
		end
		player.Character.Torso.CanCollide = true
	end
end)

game.Workspace.TeleportRUN.Teleportto.Touched:Connect(function(player)
	if player.Parent:FindFirstChild("Humanoid") then
		player.Parent:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace["Houses and buildings"].House.HouseFloor.CFrame + Vector3.new(0,2.5,0)
	end
end)

With rotation:

local prompt = game.Workspace.ProximityPromptJumpingThroughWindow.ProximityPrompt
local animation = script.Animation

prompt.PromptButtonHoldBegan:Connect(function(player)
	if player.Character:FindFirstChild("HumanoidRootPart") then
		
		player.Character.Torso.CanCollide = false
		player.Character.Humanoid.WalkSpeed = 0
		local hum = player.Character.Humanoid
		local loadanim = hum.Animator:LoadAnimation(animation)
		
		player.Character:FindFirstChild("HumanoidRootPart").CFrame = CFrame.new(-1122.589, 158.136, 445.214, 0, 90, 0, 0)
		loadanim:Play()
	end
end)

prompt.Triggered:Connect(function(player)
	if player.Character:FindFirstChild("HumanoidRootPart") then
		player.Character:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.TeleportRUN.Teleportto.CFrame
		
		game.Workspace.TeleportRUN.Teleportto.CanTouch = false
		
		wait(3)
		
		game.Workspace.TeleportRUN.Teleportto.CanTouch = true
	end
end)

prompt.PromptButtonHoldEnded:Connect(function(player)
	if player.Character:FindFirstChild("HumanoidRootPart") then
		player.Character.Humanoid.WalkSpeed = 16
		local hum = player.Character.Humanoid
		
		local loadanim = hum.Animator:GetPlayingAnimationTracks(animation)
		for i, track in pairs (loadanim) do
			track:Stop()
		end
		player.Character.Torso.CanCollide = true
	end
end)

game.Workspace.TeleportRUN.Teleportto.Touched:Connect(function(player)
	if player.Parent:FindFirstChild("Humanoid") then
		player.Parent:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace["Houses and buildings"].House.HouseFloor.CFrame + Vector3.new(0,2.5,0)
	end
end)

The issue probably isn’t the rotation of the character (assuming you’ve already attempted to rotate the character /HumanoidRootPart to face the window) but an issue with the actual animation. You could try going back into the animation editor and rotating it a different angle and perhaps that will fix it. The issue could be as simple as when the animation was made it was made in a weird angle or something goofed.

Apologies if this isn’t much help; rotating the actual animation is the only core fix I can think of.

ok, I’mma try it.
(goofy char limit)

Wow. I’m dumb. It worked. Ty!
(char limit)

1 Like