Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I fix crazy block spasm?

-- Local Script In StarterPack
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Brick = workspace:WaitForChild("Brick")

Mouse.Move:connect(function()
    Brick.CFrame = Mouse.Hit
end)

Is there anyway to make it not crazy but more of simply on the ground, not inside the ground like when you spawn a part it goes half underground.

https://gyazo.com/46bb72b1bb5c8817b9bc05a83fa4e454 PLEASE WATCH THIS IT SHOWS, INCASE IT DOESNT SHOW, ILL EXPLAIN IT SOME MORE

--- Okay so basiclly what is happening is, I made it so this anchored block in workspace, follows my mouses position, but it keeps floating and zooming into my camera, what I want it to be like is like a building game. You guys know those building games where when your about to place something, it has a transparent block of what you selected, to show where your going to place the block, I want it like that. And for it to not clip through the baseplate or plot.

1 answer

✓ Accepted answer

Your mouse is hitting the brick itself that you have spawned thus causing it to move it closer and closer to your screen. So the answer to your problem is: You need the mouse to ignore that particular part.

Like so:

-- Local Script In StarterPack
local plr = game.Players.LocalPlayer
local Mouse = plr:GetMouse()
local Brick = workspace:WaitForChild("Brick")
Mouse.TargetFilter = Brick

Mouse.Move:connect(function()
    Brick.CFrame = Mouse.Hit
end)

You can learn more about mouse.TargetFilter here

2 comments

1

Okay it worked, thanks so much!

0

No problem!

This discussion is preserved as it was. New answers, comments, and votes are closed.