Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can someone help me ?

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

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

This discussion is preserved as it was. New answers, comments, and votes are closed.