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 » Scripters
Home Search
 

Re: Massive, Major script problem

Previous Thread :: Next Thread 
hexon7575 is not online. 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
superconscript is not online. superconscript
Joined: 15 Mar 2012
Total Posts: 413
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 is not online. hexon7575
Joined: 09 Oct 2010
Total Posts: 210
26 Oct 2016 08:41 PM
It is in a LocalScript. Same problem.
Report Abuse
superconscript is not online. superconscript
Joined: 15 Mar 2012
Total Posts: 413
26 Oct 2016 08:44 PM
Does the output say any errors?
Report Abuse
hexon7575 is not online. 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 is not online. hexon7575
Joined: 09 Oct 2010
Total Posts: 210
26 Oct 2016 09:20 PM
bump
Report Abuse
raik220 is not online. 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
foreverpower is not online. foreverpower
Joined: 05 Feb 2011
Total Posts: 5578
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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