I’m currently working on a transforming ability where a player presses a button which fires a remote event on the server. Everything is working apart from when I use PivotTo(). The players character turns to a 90 degree default rotation. I’ve used MoveTo() and tried seperatly moving the rotation but nothing seems to work. I am using PivotTo() on other models and that seems to be working but I am stuck on trying to get this script to work:
game.ReplicatedStorage.MainGameRemoteEvents.TransformMonster.OnServerEvent:Connect(function(Player, rotation)
print(rotation)
if Player.Character.Name == "Monster" then
local character = game.ReplicatedStorage.Characters[Player.Name] -- Get the original character
character.Parent = workspace -- Set the character to the workspace
character.UpperTorso.CFrame = Player.Character.UpperTorso.CFrame
local vector = Player.Character -- Get the position of the monster
Player.Character.Parent = game.ReplicatedStorage -- Set the monster to Replicated Storage
Player.Character = character -- Set the players character to the character
Player.Character:PivotTo(vector.PrimaryPart.CFrame) -- Move the original character to the players position
else
local monster = game.ReplicatedStorage.Characters.Monster:Clone() -- Clone the monster
monster.Parent = workspace -- Set the monster to the workspace
monster.UpperTorso.CFrame = Player.Character.UpperTorso.CFrame
local vector = Player.Character -- Get the position of the original character
local character = Player.Character:Clone()
character.Parent = game.ReplicatedStorage.Characters-- Set the players character to Replicated Storage
Player.Character = monster -- Set the players character to the monster
Player.Character:PivotTo(vector.PrimaryPart.CFrame) -- Move the monster to the players position
end
end)