|
| 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 |
|
|
|
| 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 |
|
|
|
| 01 Nov 2011 02:09 PM |
^ failed
if part.Name=="Laser" or part.Name=="Torpedo" then |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 01 Nov 2011 03:10 PM |
| Bump. Signature's offline because I'm at friend's house :( |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 01 Nov 2011 04:40 PM |
Bump
~Dr. Pwnguin, UR General. Request to join now! |
|
|
| Report Abuse |
|
|
|
| 02 Nov 2011 02:12 AM |
Brumpadump.
~Dr. Pwnguin, UR General. Request to join now! |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|