Hi, I'm struggling to understand how to do this, basically how do I make it so that an object follows your mouse but doesn't move the object in the (x,y) positions only the (z) position? This is my attempted script:
-- Player
local Player = game.Players.LocalPlayer
local Character = workspace:WaitForChild(Player.Name)
local Mouse = Player:GetMouse()
-- Services
local Storage = game:GetService("ReplicatedStorage")
local RunService = game:GetService("RunService")
-- Content
local Gear = Storage:FindFirstChild("Gear")
local Models = Gear:FindFirstChild("Models")
local Killer = {}
local Model = Models:FindFirstChild("Killer"):WaitForChild("BearTrap"):Clone()
Model.Parent = workspace
RunService.RenderStepped:Connect(function()
local MousePos = Mouse.Hit
Model:SetPrimaryPartCFrame(Character.HumanoidRootPart.CFrame * CFrame.new(0, -0.55, Mouse.Hit.p))
end)
Here is the focus:
RunService.RenderStepped:Connect(function()
local MousePos = Mouse.Hit
Model:SetPrimaryPartCFrame(Character.HumanoidRootPart.CFrame * CFrame.new(0, -0.55, Mouse.Hit.p))
end)
I have tried this and it doesn't work, I have tried other ways and it errors. Is there anyone that can help? If you don't understand I can try to provide examples of what I want it to be like.
Thanks.

1 comment
cant you do mouse.Hit.Z?