Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My script wont place the block in the right place, how would I fix this?

Asked by 3 years ago

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

0
So.. what is the script's parent? sne_123456 439 — 3y
0
The first script's parent is starterPlayerScripts and the second one is the part that follows your mouse johndoe1000000010110 0 — 3y

Answer this question