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
 

full/semi auto

Previous Thread :: Next Thread 
awsmprsnwhopwns is not online. awsmprsnwhopwns
Joined: 06 May 2011
Total Posts: 77
12 May 2012 09:55 PM
This is a script that I wrote myself to make a gun change between semi and full automatic when you press T. "Shooter" is the full auto script, "Shooter2" is for semi auto.

function switch()
if KeyDownFunctions == "t" and script.parent.LocalScript "Shooter".Disabled = false
then
script.parent.LocalScript "Shooter".Disabled = true
script.parent.LocalScript "Shooter2".Disabled = false
else if KeyDownFunctions == "t" and script.parent.LocalScript "Shooter".Disabled = true
then
script.parent.LocalScript "Shooter".Disabled = false
script.parent.LocalScript "Shooter2".Disabled = true
end

Please help me with this, I need it as soon as possible.
Report Abuse
HuntHello is not online. HuntHello
Joined: 19 Jan 2011
Total Posts: 577
12 May 2012 09:58 PM
What help do you need?
Report Abuse
abaw7 is not online. abaw7
Joined: 23 Oct 2009
Total Posts: 745
12 May 2012 09:59 PM

Make the LocalScript Shooter and Shooter2 named Shooter and Shooter2 then:

function switch()
if KeyDownFunctions == "t" and script.parent["Shooter"].Disabled = false
then
script.parent.LocalScript "Shooter".Disabled = true
script.parent.LocalScript "Shooter2".Disabled = false
else if KeyDownFunctions == "t" and script.parent["Shooter"].Disabled = true
then
script.parent["Shooter"].Disabled = false
script.parent["Shooter2"].Disabled = true
end
Report Abuse
abaw7 is not online. abaw7
Joined: 23 Oct 2009
Total Posts: 745
12 May 2012 09:59 PM
Also add in another end.
function switch()
if KeyDownFunctions == "t" and script.parent["Shooter"].Disabled = false
then
script.parent.LocalScript "Shooter".Disabled = true
script.parent.LocalScript "Shooter2".Disabled = false
else if KeyDownFunctions == "t" and script.parent["Shooter"].Disabled = true
then
script.parent["Shooter"].Disabled = false
script.parent["Shooter2"].Disabled = true
end
end
Report Abuse
Nyht is not online. Nyht
Joined: 18 Apr 2011
Total Posts: 41
12 May 2012 10:02 PM
Got no errors once I ran this:


function switch()
if KeyDownFunctions == "t" and script.parent.LocalScript "Shooter".Disabled == false then
script.parent.LocalScript "Shooter".Disabled = true
script.parent.LocalScript "Shooter2".Disabled = false
else if KeyDownFunctions == "t" and script.parent.LocalScript "Shooter".Disabled == true then
script.parent.LocalScript "Shooter".Disabled = false
script.parent.LocalScript "Shooter2".Disabled = true
end
end
end
Report Abuse
Nyht is not online. Nyht
Joined: 18 Apr 2011
Total Posts: 41
12 May 2012 10:04 PM
I ran it three times before I got no more errors, and these were the errors:


workspace.Script:2: 'then' expected near '=' (forgot an '=' sign both on line 2 and 4)
Workspace.Script:9: 'end' expected (to close 'if' at line 2) near '< eof >' (forgot an end)
Workspace.Script:9: 'end' expected (to close 'function' at line 1) near '< eof >' (forgot an end)
Report Abuse
abaw7 is not online. abaw7
Joined: 23 Oct 2009
Total Posts: 745
12 May 2012 10:05 PM
That's odd. Also I forgot to completely edit it.

function switch()
if KeyDownFunctions == "t" and script.parent["Shooter"].Disabled == false then
script.parent["Shooter"].Disabled = true
script.parent["Shooter2"].Disabled = false
elseif KeyDownFunctions == "t" and script.parent["Shooter"].Disabled == true then
script.parent["Shooter"].Disabled = false
script.parent["Shooter2"].Disabled = true
end
end

There you go
Report Abuse
Nyht is not online. Nyht
Joined: 18 Apr 2011
Total Posts: 41
12 May 2012 10:10 PM
Oh, now I know why the third "end" was needed... elseif is one, not two, words.
Report Abuse
awsmprsnwhopwns is not online. awsmprsnwhopwns
Joined: 06 May 2011
Total Posts: 77
12 May 2012 10:36 PM
no, it still doesn't work. The main problem is that the two local scripts (shooter and shooter2) don't become enabled and disabled when I press t.

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