| |
|
| |
|
|
| 14 Jan 2012 02:12 AM |
-.- you need help with something ?
*points to the Forum name*! |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Jan 2012 02:16 AM |
| ok thx for the information |
|
|
| Report Abuse |
|
|
|
| 14 Jan 2012 02:17 AM |
| but just keep in mind best should know what Scripting Helpers forum is for before posting in there :P |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 14 Jan 2012 05:25 AM |
Right if you think you are good here is a pickle
Ive made a box stuck it to a plane and grouped it. I need to add a bit that says if "T" is pressed it deletes the box and droppes the tank I have tried but i do not know how to make a connection with the vehicle you are using.I dont need anyone looking at the whole script just add a line or somethingso i can drop the tank Here is the script:
bin=script.Parent plane=nil hold=false local debounce = false local planedebounce = false local stuntdebounce = false local controlling = false
function fire(pln,spn) local missile = bin.Rocket:clone() missile.CFrame = spn.CFrame * CFrame.new(0, 0, -35)
missile.RocketScript.Disabled = false missile.Parent = game.Workspace
local creator_tag = Instance.new("ObjectValue") creator_tag.Value = game.Players.LocalPlayer creator_tag.Name = "creator" creator_tag.Parent = missile
missile.Owner.Value = pln end
function bomb(pln,spn) local missile = bin.Bomb:clone() missile.CFrame = spn.CFrame * CFrame.new(0, -10, 0)
missile.RocketScript.Disabled = false missile.Parent = game.Workspace
local creator_tag = Instance.new("ObjectValue") creator_tag.Value = game.Players.LocalPlayer creator_tag.Name = "creator" creator_tag.Parent = missile
missile.Owner.Value = pln end
function computeDirection(vec) local lenSquared = vec.magnitude * vec.magnitude local invSqrt = 1 / math.sqrt(lenSquared) return Vector3.new(vec.x * invSqrt, vec.y * invSqrt, vec.z * invSqrt) end
function move(target, engine) local origincframe = engine:findFirstChild("BodyGyro").cframe local dir = (target - engine.Position).unit local spawnPos = engine.Position
local pos = spawnPos + (dir * 1)
engine:findFirstChild("BodyGyro").maxTorque = Vector3.new(9000, 9000, 9000) engine:findFirstChild("BodyGyro").cframe = CFrame.new(pos, pos + dir) wait(0.1) engine:findFirstChild("BodyGyro").maxTorque = Vector3.new(0, 0, 0) engine:findFirstChild("BodyGyro").cframe = origincframe end
function findPlane(player) local list = player.Character:GetChildren() for x = 1, #list do if (list[x].Name == "Plane") then local weld = list[x]:FindFirstChild("Parts"):FindFirstChild("Seat"):FindFirstChild("SeatWeld") if (weld ~= nil) and (weld.Part1 == player.Character:FindFirstChild("Torso")) then return list[x] end end end return nil end
function onButton1Down(mouse) local vehicle = findPlane(script.Parent.Parent.Parent) if vehicle ~= nil and debounce == false and planedebounce == false then debounce = true
controlling = true
while true do wait() local engine = vehicle.Parts.Engine local position = mouse.Hit local target = position.p if engine:findFirstChild("FlyScript") ~= nil then move(target, engine) end if planedebounce == true or controlling == false then break end end wait(.1) debounce = false end end
function onButton1Up(mouse) controlling = false end
function onSelected(mouse) mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) mouse.Button1Up:connect(function() onButton1Up(mouse) end) mouse.KeyDown:connect(onKeyDown) end
function onKeyDown(key) if (key~=nil) then key = key:lower() local vehicle = findPlane(script.Parent.Parent.Parent) if (vehicle==nil) then return end plane = vehicle.Parts local engine = vehicle.Parts.Engine if (key=="f") and (bin.Reload.Value == 0) then fire(vehicle,plane.Gun1) fire(vehicle,plane.Gun2) bin.Reload.Value = 1 wait(0.25) bin.Reload.Value = 0 end if (key=="b") and (bin.Reload.Value == 0) then bomb(vehicle,plane.Engine) bin.Reload.Value = 1 wait(0.5) bin.Reload.Value = 0 end if (key=="x") and planedebounce == false then local power = plane.Engine:findFirstChild("FlyScript") if (power ~= nil) then power:remove() end end if (key=="y") then local power = plane.Engine:findFirstChild("FlyScript") if (power ~= nil) then return end local fly = script.FlyScript:clone() fly.Disabled = false fly.Parent = plane.Engine end if (key=="k") and planedebounce == false then wait() engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y -0.7, 0) wait() engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y -0.7, 0) wait() engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y -0.7, 0) wait() engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y -0.7, 0) end if (key=="h") and planedebounce == false then wait() engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y +0.7, 0) wait() engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y +0.7, 0) wait() engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y +0.7, 0) wait() engine.RotVelocity = Vector3.new(0, engine.RotVelocity.y +0.7, 0) return end if (key=="j") and planedebounce == false then local body = plane.Engine.BodyGyro body.maxTorque = Vector3.new(9000, 9000, 9000)
local position = engine.CFrame * Vector3.new(0, 0.5, -4) local dir = position - engine.Position
dir = computeDirection(dir)
local spawnPos = engine.Position
local pos = spawnPos + (dir * 8)
body.cframe = CFrame.new(pos, pos + dir) wait(.2) body.maxTorque = Vector3.new(0, 0, 0) end if (key=="l") and planedebounce == false then local body = plane.Engine.BodyGyro body.maxTorque = Vector3.new(9000, 0, 0) local frame = plane:FindFirstChild("OriginCFrame") if frame ~= nil then body.cframe = frame.Value end wait(0.1) body.maxTorque = Vector3.new(0, 0, 0) end if (key=="u") and planedebounce == false then local body = plane.Engine.BodyGyro body.maxTorque = Vector3.new(9000, 9000, 9000)
local position = engine.CFrame * Vector3.new(0, -0.5, -4) local dir = position - engine.Position
dir = computeDirection(dir)
local spawnPos = engine.Position
local pos = spawnPos + (dir * 8)
body.cframe = CFrame.new(pos, pos + dir) wait(.2) body.maxTorque = Vector3.new(0, 0, 0) end if (key=="g") and planedebounce == false and stuntdebounce == false then planedebounce = true stuntdebounce = true plane.Parent.Stunt.Value = 1 local body = plane.Engine.BodyGyro body.maxTorque = Vector3.new(9000, 9000, 9000)
local currentframe = plane.Engine.CFrame
for i = 1,6 do body.cframe = plane.Engine.CFrame * CFrame.fromEulerAnglesXYZ(0, 0, 30) wait(.2) end
body.cframe = currentframe wait(.6)
body.maxTorque = Vector3.new(0, 0, 0) planedebounce = false plane.Parent.Stunt.Value = 0 wait(3) stuntdebounce = false end if (key=="t") and planedebounce == false and stuntdebounce == false then planedebounce = true stuntdebounce = true plane.Parent.Stunt.Value = 1 local body = plane.Engine.BodyGyro body.maxTorque = Vector3.new(9000, 9000, 9000)
local currentframe = plane.Engine.CFrame local valy = 30 local valz = 30
for i = 1,8 do body.cframe = currentframe * CFrame.fromEulerAnglesXYZ(0, valy, valz) valy = valy +50 valz = valz +100 wait(.1) end
body.cframe = currentframe * CFrame.fromEulerAnglesXYZ(0, 600, 0)
wait(.5)
body.maxTorque = Vector3.new(0, 0, 0) planedebounce = false plane.Parent.Stunt.Value = 0 wait(4) stuntdebounce = false end end end
|
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
Cyrok
|
  |
| Joined: 11 Jan 2012 |
| Total Posts: 630 |
|
|
| 14 Jan 2012 08:51 PM |
So you admitted you were trolling, and then you continue to bump this thread? I don't mean to degrade you, but this forum is here to help debug code and explain concepts related to RBX.Lua or Lua.
{ Have a short chunk of code that isn't working? Send me a message and maybe I can assist you. } |
|
|
| Report Abuse |
|
|
zell11
|
  |
| Joined: 20 Jun 2009 |
| Total Posts: 2998 |
|
| |
|
| |
|
Ronster55
|
  |
| Joined: 08 Jan 2010 |
| Total Posts: 2739 |
|
|
| 14 Jan 2012 10:20 PM |
You're my idol.
~~~One day turtles will rule the world~~~ *derp face* DERP |
|
|
| Report Abuse |
|
|