So Today I wanted to test some Building system. I didn’t want to watch any tutorial because everyone has a different system and I don’t understand their code because they make like 10 scripts when you really need 10 lines or so. I tried scripting the Blocks position to the mouse and It worked good until.
it didn’t stop colliding with itself and teleported into my camera, How to I disable the Hit on the block I hope theres anyway to solve this problem. I searched up almost all forums and found nothing execpt other stuff thats not related to my problem.If you’re using RunService for example, you could parent the part to nil, then check mouse.Hit, then change the position and parent. This runs relatively quick and I’ve used this method in many cases.
RunService.RenderStepped:Connect(function()
part.Parent = nil
part.Position = mouse.Hit.p
part.Parent = workspace
end)
This just uses the fact that it reads code line per line
I mean the part is colliding with itself because It wants to get on the floor but it sees itself to it goes up and up and up to your mouse
Ohh now I get what you mean!
Yes, because when you’re checking mouse.Hit while the part is in the workspace, it will register the hit on the part. If the part is parented nil it won’t register the part.
But now It started flickering and it hurts my eyes “And I can’t access workspace anymore”
Are there any wait()'s in the code? Could you share the snippet of code?
oh. oops yeah I forgot to delete that because I changed it to renderstepped instead while true do but Its still flickering
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local render = game:GetService("RunService")
local Obj = game.ReplicatedStorage.Blocks.WoodenBlock:Clone()
Obj.Block.Color = Color3.fromRGB(0, 255, 0)
Obj.Block.Material = Enum.Material.Neon
Obj.Block.Transparency = 0.75
if Obj.Block:IsA("UnionOperation") then
Obj.Block.UsePartColor = true
end
render.RenderStepped:Connect(function()
if mouse.Hit then
Obj.Parent = nil
Obj:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z))
Obj.Parent = game.Workspace
else
Obj.Parent = nil
end
end)
this is my code I used
That’s odd; I’ve never experienced this flickering before. Alternatively, I found we can parent the object to the character instead.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local render = game:GetService("RunService")
local Obj = game.ReplicatedStorage.Blocks.WoodenBlock:Clone()
Obj.Block.Color = Color3.fromRGB(0, 255, 0)
Obj.Block.Material = Enum.Material.Plastic
Obj.Block.Transparency = 0
if Obj.Block:IsA("UnionOperation") then
Obj.Block.UsePartColor = true
end
Obj.Parent = player.Character or player.CharacterAdded:Wait()
render.RenderStepped:Connect(function()
if mouse.Hit then
Obj:SetPrimaryPartCFrame(CFrame.new(mouse.Hit.X,mouse.Hit.Y,mouse.Hit.Z))
else
Obj.Parent = nil
end
end)
btw Is there any way flooring to 0,5 instead 1 because of the stud system? nevermind found out
Go to “Model” tab in studio, look around for the “Position” and “Rotation” checkboxes. It should be next to the Move-Rotate-Scale-Transform thing. Uncheck both boxes, and you can move and rotate with no studs. Or, if you want 0.5, check the studs box and type 0.5.
Nvm you found out right.
btw I mean with the mouse ingame
yeah, it applies to the drag parts too
nono I mean math.floor() instead 1 to 2 1 to 0.5 but I add *10/10 but I have a problem that the mouse only applys to the selected 0.25 only shows