So, I’ve made a Tool, that if you Activate it, it creates a Wall on the Player’s Mouse Hit Position and with the Player’s Camera Rotation, like this:
-- Script
local Pos, CamCF = MouseLoc:InvokeClient(Player)
ClonedWall:SetPrimaryPartCFrame(CFrame.new(Pos + Vector3.new(0, 0.5, 0), Pos + Vector3.new(CamCF.lookVector.X, CamCF.lookVector.Y, CamCF.lookVector.Z)))
-- Local Script
local camera = game.Workspace.CurrentCamera
local Mouse = game.Players.LocalPlayer:GetMouse()
function Remote.OnClientInvoke()
return Mouse.Hit.p, camera.CFrame
end
But I can’t make the Model Stand Up, a.k.a only rotate it’s Y-Axis to the Player’s Camera’s Y-Axis Rotation.
Video
1 Like
DasKairo
(Cairo)
December 7, 2022, 1:55pm
#2
Hi,
Use PivotTo
instead of SetPrimaryPartCFrame
as it has been Deprecated ,
Example:
workspace.Model:PivotTo(workspace.Model.WorldPivot * CFrame.Angles(0,10,0))
3 Likes
-- Script
local Pos, CamCF = MouseLoc:InvokeClient(Player)
ClonedWall:PivotTo(CFrame.new(Pos + Vector3.new(0, 0.5, 0), Pos + Vector3.new(CamCF.lookVector.X, 0.5, CamCF.lookVector.Z)))
TenBlocke
(Decablocks)
December 8, 2022, 10:18am
#4
Just use the global Y axis in a CFrame.lookat constructor
local goalCF = CFrame.lookAt(Pos + Vector3.new(0, 0.5, 0), Pos + CamCF.LookVector, Vector3.yAxis)
ClonedWall:PivotTo(goalCF)
Lielmaster:
ClonedWall:PivotTo(CFrame.new(Pos + Vector3.new(0, 0.5, 0), Pos + Vector3.new(CamCF.lookVector.X, 0.5, CamCF.lookVector.Z)))
This worked. Thank you guys so much!
system
(system)
Closed
December 23, 2022, 1:00am
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.