Talk:HopperBins: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>Mindraker
Testing
 
>Mindraker
Testing
(No difference)

Revision as of 23:57, 26 August 2008

Testing

These following scripts do work:

Boulder Summoner

lifetime = 5 -- how long the boulder stays there. 5 is a good value.

function onButton1Down(mouse)
	local b = Instance.new("Part")
	b.BrickColor = BrickColor.new(217)
	b.Position = mouse.Hit.p
	b.Size = Vector3.new(5, 5, 5)
	b.Shape = 0
	b.Parent = game.Workspace
	b.Velocity = (script.Parent.Parent.Parent.Character.Head.Position - mouse.Hit.p).unit * -50 + Vector3.new(0, 10, 0)
	-- pushes it away from you, and pops it up a bit, making it seem to come out of the ground.
	game:GetService("Debris"):AddItem(b, lifetime)
end

function onSelected(mouse)
	mouse.Button1Down:connect(function() onButton1Down(mouse) end) -- Button1Down doesn't come with a mouse, seeing as its
	-- an event of the mouse itself. We need to give the function the mouse object to work off of.
end

script.Parent.Selected:connect(onSelected) -- Selected comes with a mouse.


Simple Toggle Utility

brickName = "Toggle"
valueName = "On/Off"

function onButton1Down(mouse)
	local targ = mouse.Target
	if targ~=nil then
		if targ.Name == brickName then
			if targ:findFirstChild(valueName)~=nil then
				if targ[valueName].Value == true then
					targ[valueName].Value = false
				else
					targ[valueName].Value = true
				end
			end
		end
	end
end

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

script.Parent.Selected:connect(onSelected)

Mouse Without HopperBin -- this was rather subtle. All that happened was my HopperBin box dissappeared. Was that what was supposed to happen? MINDRAKER 18:57, 26 August 2008 (CDT)