I have this script that places a block depending on where the mouse is, but whenever I click to place the block, it spawns at the wrong location. Please help! Here are the two scripts:
local player = game.Players.LocalPlayer local mouse = player:GetMouse() mouse.TargetFilter = game.Workspace.Part while wait() do game.Workspace.Part.Position = mouse.Hit.p + game.ReplicatedStorage.Part2.Size end
this one moves a partially transparent part to follow the mouse
local Click = script.Parent if Click.Parent.Name == "Part2" then Click:Destroy() script:Destroy() end Click.MouseClick:Connect(function() local Part2 = Click.Parent:Clone() Part2.Parent = workspace Part2.Name = Click.Parent.Name..2 Part2.Position = Click.Parent.Position Part2.Size = Click.Parent.Size Part2.Transparency = 0 Part2.CanCollide = true end)
this one is supposed to place the block when I click