Hi there, I am trying to make a game where you need to grab and move objects. Kind of like Portal but not like equipping a tool. I want it to move to the front of where the player is looking and can’t do that.
I have 2 problems, the first is that I am using Camera.CFrame.LookVector
and it doesn’t seem to go in the direction the player’s camera is facing. (First-Person) The second is that I am using the script to check what Mouse.Target
is and moving that. With that, it doesn’t work because if an object is parented and is welded, the welded parts don’t react because they only react to forces such as gravity. I need them to be able to move with the target. (Sorry if this paragraph is long ) Here is my current script:
local CamCFrame = CFrame.new()
game.ReplicatedStorage.RemoteEvents.Grab.OnServerEvent:Connect(function(Player,Torso,Target,GrabPos,Camera)
local Holding = true
if Target.Name == "Vent" then
Target.Anchored = false
end
while Holding do
Target.Position += CamCFrame.LookVector * 5
wait()
Target.Position -= CamCFrame.LookVector * 5
end
end)
game.ReplicatedStorage.RemoteEvents.GrabLook.OnServerEvent:Connect(function(Player,CCFrame)
CamCFrame = CCFrame
end)