hexon7575
|
  |
| Joined: 09 Oct 2010 |
| Total Posts: 210 |
|
|
| 26 Oct 2016 08:36 PM |
local launchername = "SeaWolf" -- Change this to the name of the part that the missile launches from local tool = script.Parent local coord = nil local Weapon = script.Parent local wolf = game.Workspace:findFirstChild(launchername) local debounce = script.Value.Value local missilecode = "AHHFWF2347856BDHSHWBGYIW" -- Set this to a unique value by smashing your face on your keyboard
tool.Equipped:connect(function(mouse) mouse.KeyDown:connect(function(key) if key == "f" and coord ~= nil and debounce == false then script.Parent.Name = "FIRING..." debounce = true local missile = Instance.new("Part", game.Workspace) -- Create the missile missile.Position = Vector3.new(wolf.Position.X, wolf.Position.Y + 5, wolf.Position.Z) -- Create it above part to prevent welding missile.Name = missilecode missile.Size = Vector3.new(1,5,1) missile.BrickColor = BrickColor.new("Dark stone gray") missile.TopSurface = "Smooth" missile.BottomSurface = "Smooth" Instance.new("Fire", missile) local bodyvel = Instance.new("BodyVelocity", missile) -- Give it velocity bodyvel.Velocity = Vector3.new(0, 100, 0) -- Let's get it in the air! wait(2) bodyvel:remove() -- get rid of the velocity local charge = script.ExplosionScript:clone() charge.Parent = missile local bodypos = Instance.new("BodyPosition", missile) bodypos.MaxForce = Vector3.new(4000000,4000000,4000000) bodypos.P = 10000 bodypos.D = 400 script.Parent.Name = "TRACKING..." while game.Workspace:findFirstChild(missilecode) do wait() bodypos.Position = coord.Position-- Move it towards the target end script.Parent.Name = "RELOADING..." wait(10) debounce = false script.Parent.Name = "Sea Wolf" end end) mouse.Button1Down:connect(function() local ray = Ray.new( -- Create a new ray Weapon.Handle.CFrame.p, -- origin (mouse.Hit.p - Weapon.Handle.CFrame.p).unit * 500 -- direction ) local hit, position, normal = Workspace:FindPartOnRay(ray) -- Define what part is hit and what the coordinates are if hit.Parent ~= tool.Parent then coord = hit -- Set the value of coord to where the ray hits end end) end)
This script works completely fine in Roblox Studio test, however in Roblox itself, it does absolutely nothing. Does anyone have any idea why or is roblox just really, really bad at making testing platforms? |
|
|
| Report Abuse |
|
|
|
| 26 Oct 2016 08:40 PM |
In local script? If not it may because you call "mouse.Button1Down:connect(function()" I believe the mouse action (button1down) can only be used in local script. |
|
|
| Report Abuse |
|
|
hexon7575
|
  |
| Joined: 09 Oct 2010 |
| Total Posts: 210 |
|
|
| 26 Oct 2016 08:41 PM |
| It is in a LocalScript. Same problem. |
|
|
| Report Abuse |
|
|
|
| 26 Oct 2016 08:44 PM |
| Does the output say any errors? |
|
|
| Report Abuse |
|
|
hexon7575
|
  |
| Joined: 09 Oct 2010 |
| Total Posts: 210 |
|
|
| 26 Oct 2016 08:47 PM |
None whatsoever. Still, nothing happens when I play the game. |
|
|
| Report Abuse |
|
|
hexon7575
|
  |
| Joined: 09 Oct 2010 |
| Total Posts: 210 |
|
| |
|
raik220
|
  |
| Joined: 13 Jun 2011 |
| Total Posts: 241 |
|
|
| 26 Oct 2016 09:50 PM |
| did you change cord from nil? you set it to nil, then ask if its not nil. |
|
|
| Report Abuse |
|
|
|
| 26 Oct 2016 09:51 PM |
Change this line to to use WaitForChild: local wolf = game.Workspace:findFirstChild(launchername)
i.e., change it to this:
local wolf = game.Workspace:WaitForChild(launchername) |
|
|
| Report Abuse |
|
|