Salutations!
This is the question:
How do I move my model to my mouse position?
Or and easier one, How do I convert Vector3 into CFrame (Using SetPrimaryPartCFrame())
Thank you!
Salutations!
This is the question:
How do I move my model to my mouse position?
Or and easier one, How do I convert Vector3 into CFrame (Using SetPrimaryPartCFrame())
Thank you!
You can convert Vector3 to CFrame easily.
CFrame.new(Vector3)
This actually worked perfectly! Thank you!
Local Script:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local positiontomove = 0
local remotevent = --
mouse.Button1Up:Connect(function()
local position = positiontomove
if position ~= 0 then
print(position)
remotevent:FireServer(CFrame.new(position)
end
en)
while wait() do
local mouseray = mouse.UnitRay
local ignlist = {clone}
local castray = Ray.new(mouseray.Origin, mouseray.Direction * 1000)
local hit, position = workspace:FindPartOnRayWithIgnoreList(castray, ignlist)
if hit then
positiontomove = position
else
positiontomove = 0
end
end
Server Script:**
local remoteevent = --define here
reoteevent.OnServerEvent:Connect(function(player, CFrame)
player.Character:SetPrimaryPartCFrame(CFrame)
end)