script.Parent.Equipped:connect(function(mouse) local player = script.Parent.Parent.HumanoidRootPart mouse.Button1Down:connect(function() local mousePos = mouse.Hit player.CFrame = CFrame.new(mouse.Hit.p + Vector3.new(0,5,0)) -- this is where it doesn't work end) end)
If this helped, please be sure to accept my answer :)
local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() -- Waits for character to add in workspace. local Mouse = Player:GetMouse() -- Gets player's mouse. script.Parent.Equipped:Connect(function() Mouse.Button1Down:Connect(function() local MousePos = Mouse.Hit -- You have made his variable and did no even use it, so lets use it on the line below. Character.PrimaryPart:SetPrimaryPartCFrame(MousePos.p + Vector3.new(0,5,0)) --The player does no have a CFrame, neither the Character. But, the Character has a PrimaryPart that has a CFrame. -- this is where it doesn't work end) end)