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

Can someone help me ?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I've already did the script for it.So basicly the script makes a part appear where I click.Can you tell me how to make that part appear when I'm holding after I clicked ? the local script is in a hopper bin. Here's the script :

Player = game.Players.LocalPlayer
mouse = Player:GetMouse()
n = script.Parent

function onButton1Down(mouse)
    local x = Instance.new("Part", workspace)
    x.Name = "Crystal"
    x.Reflectance = 0.55
    x.BrickColor = BrickColor.new("Alder")
    x.TopSurface = "Smooth"
    x.BottomSurface = "Smooth"
    x.Anchored = true
    x.Size = Vector3.new(5, 30, 5)
    x.Friction = 0.4
    x.Shape = "Block"
    x.Position = mouse.Hit.p
    wait(10)
    x:remove()
    wait(0.1)
end

function onSelected(mouse)
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end

n.Selected:connect(onSelected)

1 answer

Log in to vote
0
Answered by
Savoron 15
9 years ago

Just change your mouse.Button1Down to mouse.Button1Up. This means that the function will fire when the mouse button is released.

Ad

Answer this question