Model rotation fail

  1. What do you want to achieve? Keep it simple and clear!
    Hello, I made a script that when player types out command the building that’s model pops out.

  2. What is the issue? Include screenshots / videos if possible!

Issue is that if player HRP is flying and its facing down the model will also face down. (It needs to be rotated like a normal building)

This is how it ISN’T support to look

This is code:

game.Players.PlayerAdded:Connect(function(Player)
	Player.CharacterAdded:Connect(function(char)
		Player.Chatted:Connect(function(Chat)
			if Chat == "/SpawnSpawn" then
				if Player.Name == "Kryyptik" or Player.Name == "dominik2204" then
					local newSpawn = game.ReplicatedStorage.Builidings.Spawn:Clone()
					newSpawn.Parent = workspace
					
					local postion = char.HumanoidRootPart.CFrame
					
					newSpawn:PivotTo(char.HumanoidRootPart.CFrame)
				end
			end
		end)
	end)
end)
  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I looked on YT videos and dev forum but I haven’t found solution.

try

newSpawn:PivotTo(CFrame.new(char.HumanoidRootPart.Position))

since CFrame contains both position and orientation

Not home rn. I will try when I get back

It worked thanks. have a great day/night

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