generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Lets say when I hit R I want.

Previous Thread :: Next Thread 
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
08 Sep 2012 08:23 PM
function Reload() to fire,

How would I do this?

Tool, all in one script.
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
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
ninjaknight101 is not online. ninjaknight101
Joined: 04 Apr 2011
Total Posts: 1281
08 Sep 2012 08:26 PM
you would have to use keydown functions
Report Abuse
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
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
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
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
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
08 Sep 2012 08:41 PM
No connection?

could I jsut do

function Reload(Key)

--code

Mouse.KeyDown:connect(Reload)
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
08 Sep 2012 08:43 PM
zumg!


Tool.Equipped:connect(function(Mouse)
Mouse.KeyDown:connect(Reload)
end)

forget it.
Report Abuse
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
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
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
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
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
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
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
08 Sep 2012 08:58 PM
What do you mean by Mouse = Mouse --idk?
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
08 Sep 2012 08:59 PM
forget it...
Report Abuse
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
08 Sep 2012 09:00 PM
????

I will just ignore that I guess...
Report Abuse
XxChopSlaperxX is not online. XxChopSlaperxX
Joined: 09 Nov 2010
Total Posts: 3112
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
Sharpshooter26 is not online. Sharpshooter26
Joined: 26 May 2010
Total Posts: 5166
08 Sep 2012 09:09 PM
Ok thanks
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image