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

Why does this block generating script not work properly when i try to use it?

Asked by 7 years ago

Please help me it does not want to work

--clockwork

local bin = script.Parent
brick = Instance.new("Part")
brick.FormFactor = 2
parent.BottomSurface = "Smooth"
parent.TopSurface = "Smooth"
brick.Name = "lod"
brick.Size = Vector3.new(6, 4, 6)
brick.BrickColor = BrickColor.new("Cool yellow")
brick.Transparency = 0.1
brick.Anchored = true
brick.CanCollide = true
brick.Material = "Concrete"

enabled = true



function onButton1Down(mouse)
    local player = game.Players.LocalPlayer
    if player == nil then return end
    print("trigger")
    -- find the best cf

    spew = true
    while spew do
        wait(0.1)
        newbrick = brick:clone()
        newbrick.Position = mouse.Hit.p
        game.Lighting.GoldDust:clone().Parent = newbrick
        game.Lighting.Remive:clone().Parent = newbrick
        game.Lighting.Chakra:clone().Parent = newbrick
        game.Lighting.Sparkles1:clone().Parent = newbrick
        newbrick.Parent = game.Workspace
        player.PlayerGui.Chakra.Clock.Value = player.PlayerGui.Chakra.Clock.Value - 2
    end
end

function onButton1Up(mouse)
    spew = false
end

function onSelected(mouse)
    print("select")
    mouse.Icon = "rbxasset://textures\\GunCursor.png"
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
    mouse.Button1Up:connect(function() onButton1Up(mouse) end)
end

bin.Selected:connect(onSelected)

2 answers

Log in to vote
0
Answered by 7 years ago

It seems you made a mistake while scripting, in the lines 6 and 7 it also should be brick, cause a Parent does not know what it is, so

--clockwork

local bin = script.Parent
brick = Instance.new("Part")
brick.FormFactor = 2
brick.BottomSurface = "Smooth"
brick.TopSurface = "Smooth"
brick.Name = "lod"
brick.Size = Vector3.new(6, 4, 6)
brick.BrickColor = BrickColor.new("Cool yellow")
brick.Transparency = 0.1
brick.Anchored = true
brick.CanCollide = true
brick.Material = "Concrete"

enabled = true



function onButton1Down(mouse)
    local player = game.Players.LocalPlayer
    if player == nil then return end
    print("trigger")
    -- find the best cf

    spew = true
    while spew do
        wait(0.1)
        newbrick = brick:clone()
        newbrick.Position = mouse.Hit.p
        game.Lighting.GoldDust:clone().Parent = newbrick
        game.Lighting.Remive:clone().Parent = newbrick
        game.Lighting.Chakra:clone().Parent = newbrick
        game.Lighting.Sparkles1:clone().Parent = newbrick
        newbrick.Parent = game.Workspace
        player.PlayerGui.Chakra.Clock.Value = player.PlayerGui.Chakra.Clock.Value - 2
    end
end

function onButton1Up(mouse)
    spew = false
end

function onSelected(mouse)
    print("select")
    mouse.Icon = "rbxasset://textures\\GunCursor.png"
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
    mouse.Button1Up:connect(function() onButton1Up(mouse) end)
end

bin.Selected:connect(onSelected)

0
Thank you very much! aIexcw2000 0 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

You accidentally used "parent" instead of brick in a few places.

local bin = script.Parent
brick = Instance.new("Part")
brick.FormFactor = 2
brick.BottomSurface = "Smooth"
brick.TopSurface = "Smooth"
brick.Name = "lod"
brick.Size = Vector3.new(6, 4, 6)
brick.BrickColor = BrickColor.new("Cool yellow")
brick.Transparency = 0.1
brick.Anchored = true
brick.CanCollide = true
brick.Material = "Concrete"

Answer this question