|
| 08 Sep 2012 08:23 PM |
function Reload() to fire,
How would I do this?
Tool, all in one script. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:26 PM |
function Reload(Key) if Key == "r" then --code end end
Tool.Equipped:connect(function(Mouse) Mouse.KeyDown:connect(Reload) end) end)
if that doesn't work then
Tool.Equipped:connect(function(Mouse) Mouse.KeyDown:connect(function(Key) Reload(Key) end) end) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:26 PM |
| you would have to use keydown functions |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:32 PM |
@Chop
I have a jumble of functions.
Reload,Fire, and Equip
Do I need to put the Equip connection in every single Function? |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:37 PM |
No, that's for the mouse, if you already have a tool equipped, do
Mouse(or what ever name you used for the mouse).KeyDown(function(Key) Reload(Key) end) end) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:41 PM |
No connection?
could I jsut do
function Reload(Key)
--code
Mouse.KeyDown:connect(Reload) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:43 PM |
zumg!
Tool.Equipped:connect(function(Mouse) Mouse.KeyDown:connect(Reload) end)
forget it. |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:46 PM |
Chop look at my setup
function Equip()
--Inserts some Guis end Tool.Equipped:connect(function(Mouse) end)
function Reload(Key)
--code end Mouse.KeyDown:connect(Reload)
Will this work? |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:50 PM |
function Equip(Mouse) Mouse = Mouse --idk? --Inserts some Guis end function Reload(Key)
--code end
-- Define the functions etc before connecting stuff
Tool.Equipped:connect(Equip) Mouse.KeyDown:connect(Reload) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:50 PM |
Let me show you how I did my minecraft game, little bit of the code...
function AnimateDecals() if (Target) and (Target:FindFirstChild("Block")) and not (Target.Block.Mined.Value) then for i = 1, 10 do for _,v in ipairs(Target:GetChildren()) do if (v:IsA("Decal")) then v.Texture = Asset .. Cracks[i] end end Wait(Target.Block.Time.Value / 10) end end end
script.Parent.Equipped:connect(function(Mouse) local Target local Crack Mouse.Button1Down:connect(function() Tag(Mouse) AddDecals() AnimateDecals() Mine() pcall(function() RemoveDecals() end) end) Mouse.Button1Up:connect(function() pcall(function() RemoveDecals() end) end) end) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 08:58 PM |
| What do you mean by Mouse = Mouse --idk? |
|
|
| Report Abuse |
|
|
| |
|
|
| 08 Sep 2012 09:00 PM |
????
I will just ignore that I guess... |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2012 09:02 PM |
function Equip()
--Inserts some Guis end function Reload(Key)
--code end
-- Define the functions etc before connecting stuff Tool.Equipped:connect(function(Mouse) Equip() Mouse.KeyDown:connect(function(Key) Reload(Key) end) end) |
|
|
| Report Abuse |
|
|
| |
|