You want to also define CF inside the event listener, otherwise you’re just initializing it to one value and never changing it.
local connection
script.Parent.Equipped:Connect(function(mouse)
connection = script.Parent.Activated:Connect(function()
if (mouse.Target ~= nil) then -- remove this check if you want to spawn bricks in the sky
local SP = Instance.new("SpawnLocation")
SP.CFrame = CFrame.new(mouse.Hit.Position)
SP.Parent = workspace
end
end)
end)
script.Parent.Unequipped:Connect(function()
if (connection) then
connection:Disconnect()
connection = nil
end
end)
Oh, i didn’t actually knew that Tool.Equipped had the mouse as the/an parameter, thank you for that, and i also didn’t knew that you could use an Vector3 value in an CFrame, welp, ok.
A CFrame has a Position property that just gets its location without any rotation, since mouse.Hit will be angled in the direction your camera is pointing.