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: Shield Script Help

Previous Thread :: Next Thread 
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
01 Nov 2011 01:31 PM
local power = script.Parent.Power.Value
local regenr = script.Parent.Regenr.Value
local shield = script.Parent
local maxpwr = 500
function Bonked(part)
if part.Name = "Laser" or "Torpedo" then
power = -5
shield.Transparency = 0.2
shield.Reflectance = 0.4
part:remove()
end
else end
end
script.Parent.Touched:connect(Bonked)

if power = maxpwr then end
else do
power = +regenr
end
end

Supposed to be something like Undefiant or Horatio45's shields, but I'm trying to create it myself.

Output: Workspace.Part.Script:6: 'then' expected near '='

~Dr. Pwnguin, UR General. Request to join now!
Report Abuse
InsaaneDaark is not online. InsaaneDaark
Joined: 13 Oct 2011
Total Posts: 474
01 Nov 2011 02:01 PM
if part.Name = "Laser" or "Torpedo" then

= is to set a variable. The comparison operator is ==.

if part.Name == "Laser" or "Torpedo" then

It's not only that either.

power = power + regenr
Report Abuse
deividaxas is not online. deividaxas
Joined: 20 Feb 2009
Total Posts: 1054
01 Nov 2011 02:09 PM
^ failed

if part.Name=="Laser" or part.Name=="Torpedo" then
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
01 Nov 2011 02:22 PM
I shouldha caught the ==, I've missed that before.

~Dr. Pwnguin, UR General. Request to join now!
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
01 Nov 2011 02:23 PM
New output: Workspace.Part.Script:12: 'end' expected (to close 'function' at line 5) near 'else'

~Dr. Pwnguin, UR General. Request to join now!
Report Abuse
Thunderx10 is not online. Thunderx10
Joined: 17 Jun 2009
Total Posts: 2316
01 Nov 2011 02:38 PM
local power = script.Parent.Power.Value
local regenr = script.Parent.Regenr.Value
local shield = script.Parent
local maxpwr = 500
function Bonked(part)
if part.Name == "Laser" or parent.Name == "Torpedo" then
power = -5
shield.Transparency = 0.2
shield.Reflectance = 0.4
part:remove()
end

end
script.Parent.Touched:connect(Bonked)

if power ~= maxpwr then
power = +regenr
end

- ⦅ Eating your cookies since 1957! ⦆ -
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
01 Nov 2011 02:43 PM
No output, but refuses to delete the part, despite the fact that it's named Laser.

~Dr. Pwnguin, UR General. Request to join now!
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
01 Nov 2011 03:10 PM
Bump. Signature's offline because I'm at friend's house :(
Report Abuse
InsaaneDaark is not online. InsaaneDaark
Joined: 13 Oct 2011
Total Posts: 474
01 Nov 2011 03:13 PM
@dei

Lol didn't catch that
I think it's cause I have a mask on XD
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
01 Nov 2011 04:40 PM
Bump

~Dr. Pwnguin, UR General. Request to join now!
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
02 Nov 2011 02:12 AM
Brumpadump.

~Dr. Pwnguin, UR General. Request to join now!
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
02 Nov 2011 02:20 AM
local power = script.Parent.Power.Value
local regenr = script.Parent.Regenr.Value
local shield = script.Parent
local maxpwr = 500

script.Parent.Touched:connect(function(part)
if part.Name ~= "Laser" and part.Name ~= "Torpedo" then return end

power.Value = power.Value - 5
shield.Transparency = 0.2
shield.Reflectance = 0.4
part:remove()

end)

while wait(5) do
power.Value = power.Value + regenr.Value
if power.Value > maxpwr then
power.Value = maxpwr
end
end

This is probably more of what you're looking for.

[ Disclaimer ] May not work, I'm very tired and can't test this.

"I WILL GIVE YOU BACON." - Deadmau5
~Scarfacial
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
02 Nov 2011 02:45 AM
Works, although you messed up on the Power and Regenr values. I indexed the value into the variables. Well, off to working on the next phase of it...

~Dr. Pwnguin, UR General. Request to join now!
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
02 Nov 2011 02:54 AM
Ah, didn't notice that. I'm used to changing the value of the actual variable in such situations :P

"I WILL GIVE YOU BACON." - Deadmau5
~Scarfacial
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
02 Nov 2011 02:55 AM
That didn't make sense...

I'm used to changing the value of the object rather than using a variable when an InstanceValue is present.

"I WILL GIVE YOU BACON." - Deadmau5
~Scarfacial
Report Abuse
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
02 Nov 2011 03:03 AM
Well, got the shutdown part scripted, now I just have to get the shield ONTO the test ship. CFrame time.

~Dr. Pwnguin, UR General. Request to join now!
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