Lesson: Hopperbins
4 posters
Roblox In-Sider :: Help :: Scripting :: Lua
Page 1 of 1
Lesson: Hopperbins
Hey, I have been doing pretty good with hopperbins lately. Here's is a piece of one of my hopperbins:
bin = script.Parent
function onButton1Down(mouse)
local player = game.Players.LocalPlayer
if player == nil then return end
--Insert what you want to happen here
mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
end
function onSelected(mouse)
mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
bin.Selected:connect(onSelected)
You can make yourself teleport, die, explode, mainly anything with that bit of info! Now lets move on to targets!
bin=script.Parent
function onButton1Down(mouse)
print("Clicked")
t= mouse.Target
if t~=nil and t.className == "Part" then
--Insert what you want to happen here
end
end
function onSelected(mouse)
print("Selected")
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
bin.Selected:connect(onSelected)
Naturally, if you want it so it happens when you click on a certain button, you can put:
if (t.Name == "Blah") then
You could put the name of the brick you want where "Blah" is, but be sure to put it in quotes!
bin = script.Parent
function onButton1Down(mouse)
local player = game.Players.LocalPlayer
if player == nil then return end
--Insert what you want to happen here
mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
end
function onSelected(mouse)
mouse.Icon = "rbxasset://textures\\ArrowCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
bin.Selected:connect(onSelected)
You can make yourself teleport, die, explode, mainly anything with that bit of info! Now lets move on to targets!
bin=script.Parent
function onButton1Down(mouse)
print("Clicked")
t= mouse.Target
if t~=nil and t.className == "Part" then
--Insert what you want to happen here
end
end
function onSelected(mouse)
print("Selected")
mouse.Icon = "rbxasset://textures\\GunCursor.png"
mouse.Button1Down:connect(function() onButton1Down(mouse) end)
end
bin.Selected:connect(onSelected)
Naturally, if you want it so it happens when you click on a certain button, you can put:
if (t.Name == "Blah") then
You could put the name of the brick you want where "Blah" is, but be sure to put it in quotes!
Justgoaway1- Newbie
- Posts : 10
Join date : 2008-03-23
Location : Somewhere under the rainbow.
Re: Lesson: Hopperbins
Not really a tutorial, more showing a big script and how it works. Oh well, 7/10.
>Int<
>Int<
Intile- Admin
- Posts : 10
Join date : 2008-03-22
Re: Lesson: Hopperbins
yeah he must b right o_O
bloo135isback- Beginner Poster
- Posts : 15
Join date : 2008-03-22
Re: Lesson: Hopperbins
You can also add,
if (t.Humanoid ~= nil) then
To check it's a player, am I wrong? I'm trying to figure out hopperbins and this little lesson really helped.
if (t.Humanoid ~= nil) then
To check it's a player, am I wrong? I'm trying to figure out hopperbins and this little lesson really helped.
Roblox In-Sider :: Help :: Scripting :: Lua
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|