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

Block not changing position?

Asked by
NotSoNorm 777 Moderation Voter
8 years ago

So I'm trying to get it so it changes automatically so say you move your mouse then it moves, It doesn't do that it just stays still. I'm also trying to get it to change block type when it's changed,

local last = "Slab"

script.Parent.Parent.MaterialPicker.Placing.Changed:connect(function()
    if script.Parent.Parent.MaterialPicker.Placing.Value then
        repeat
            local GetMaterial = script.Parent.Parent.Refrences:WaitForChild(currentType)
            wait(.1)
            --If diffrent then change block
            if script.Parent.Parent.Refrences:WaitForChild(currentType).Name ~= last then
                Player.Character[last].Parent = script.Parent.Parent.Refrences
                last = GetMaterial
            end
            --
            GetMaterial.Parent = Player.Character
            GetMaterial.Transparency = .6
            GetMaterial.BrickColor = BrickColor.new(script.Parent.Parent.MaterialPicker.Colors.CurrentColor.Value)
            local material = script.Parent.Parent.MaterialPicker.MainFrame.CurrentMaterial.Value
            local x = math.ceil(Mouse.Hit.p.X)-2
            local z = math.ceil(Mouse.Hit.p.Z)-2
            x1 = x%4
            z1 = z%4
            x2 = x + (4 - x1)
            z2 = z + (4 - z1)
            GetMaterial.CFrame = CFrame.new(x2, round(Mouse.Hit.p.Y, .2)+.3, z2)
            GetMaterial.Material = Enum.Material[material]
            GetMaterial.CanCollide = false
            part = GetMaterial
        until not script.Parent.Parent.MaterialPicker.Placing.Value
    end
end)

1 answer

Log in to vote
0
Answered by
Master_JJ 229 Moderation Voter
8 years ago

I might be wrong on this, but make sure the block is not anchored. I was confused on this script, sorry if I am wrong.

Ad

Answer this question