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
 

Whats wrong with this gun script?

Previous Thread :: Next Thread 
joshrocks101 is not online. joshrocks101
Joined: 07 Jun 2011
Total Posts: 1712
25 Sep 2011 02:04 PM
The script


local Tool = script.Parent;

enabled = true

local fire = Instance.new("Fire")
fire.Color = Color3.new(5,5,5)

function fire(p)

local v.Character = Tool.Parent
local vPlayer = game.Players:playersFromCharacter(vCharacter)

local missle = Instance.new("Part")

fire:clone().Parent = game.Players.Backpack.M1 Garand.Flash

local spawnPos = pCharacter.PrimaryPart.Position

local PewPew = Tool.Handle:findFirstChild("PewPew")

if (PewPew == nil) then
PewPew = Instance.new("Sound")
PewPew.Name = "PewPew"
PewPew.SoundId = "http://www.roblox.com/asset/?id=1369158"
PewPew.Parent = Tool.Handle
PewPew.Volume =20
end

spawnPos = spawnPos + (v * 10)


missle.Position = spawnPos
missle.Size = Vector3(1,1,1)
missle.Velocity = v * 450
missle.BrickColor = BrickColor.new("Really black")
missle.Shape = 0
missle.BottomSurface = 0
missle.TopSurface = 0
missle.Name = "Fire"
missle.Transperancy = 0


local force = Instance.new("BodyForce")
force.force = Vector3.new(0,98,0
force.Parent = missle

local creator_tag = Instance.new("ObjectValue")
creator_tag.Value = pPlayer
creator_tag.Name = "Creator"
creator_tag.Parent = missle

local new_script = script.Parent.LaserBlast:clone()
new_script.Disabled = false
new_script.Parent = missle

missle.Parent = game.Workspace

PewPew:Play()

end



function gunUpped()
Tool.GripForward = Vector3.new(0,.988,-.199)
Tool.GripRight = Vector3.new(1,0,0)
Tool.GripUp = Vector3.new(0,.196,.981)
end

function gunOut()
Tool.GripForward = Vector3.new(0,1.2,0)
Tool.GripRight = Vector3.new(1.3,0,0)
Tool.GripRight = Vector3.new(0,0,1.4)
end

function isTurbo(character)
return character:FindFirstChild("BoltHelm") ~= nil
end


function onActivated()
if not enabled then
return
end

enabled = false


local Character = Tool.Parent
local humanoid = character.Humanoid
if humanoid == nil then
print("humanoid not found")
return
end

local targetpos = humanoid.TargetPoint
local lookAt = (targetPos - character.Head.Position).unit

local reload = 4
--if (isTurbo(character)) then
-- reload = .10
-- print("turbo")
--end

gunUp()
fire(lookAt)
wait(reload)
gunOut()
wait(reload)

enabled = true

end

function onEquipped()
Tool.Handle.EquipSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)














output
Workspace.joshrocks101.M1 Garand.Script:10: unexpected symbol near '.'

Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Sep 2011 02:18 PM
Well, this isn't the output problem but you should look at this

force.force = Vector3.new(0,98,0

See something wrong?

Report Abuse
joshrocks101 is not online. joshrocks101
Joined: 07 Jun 2011
Total Posts: 1712
25 Sep 2011 02:24 PM
Oh yeah lolz.
Report Abuse
ImpalerOfSouls is not online. ImpalerOfSouls
Joined: 17 Jan 2010
Total Posts: 2165
25 Sep 2011 02:26 PM
"game.Players.Backpack.M1 Garand.Flash"

that too.

game.Players.Backpack["M1 Garand"].Flash
Report Abuse
joshrocks101 is not online. joshrocks101
Joined: 07 Jun 2011
Total Posts: 1712
25 Sep 2011 02:26 PM
Heres the new output i fixed the other one.

Workspace.joshrocks101.M1 Garand.Script:17: '=' expected near 'local'
Report Abuse
joshrocks101 is not online. joshrocks101
Joined: 07 Jun 2011
Total Posts: 1712
25 Sep 2011 02:43 PM
I almost have the script working heres the new output.

Workspace.joshrocks101.M1 Garand.Script:45: ')' expected (to close '(' at line 44) near 'force'
Report Abuse
miz656 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
25 Sep 2011 03:02 PM
Josh

1. Did you change what I said? Cause I think that's what the output means


2. You spelled transparency wrong.
Report Abuse
joshrocks101 is not online. joshrocks101
Joined: 07 Jun 2011
Total Posts: 1712
25 Sep 2011 03:09 PM
@miz Yeah and now my output says.


Workspace.joshrocks101.M1Garand.Script:30: attempt to perform arithmetic on global 'v' (a nil value)
Report Abuse
joshrocks101 is not online. joshrocks101
Joined: 07 Jun 2011
Total Posts: 1712
25 Sep 2011 03:18 PM
I got it working, :D Now i just have to find a good gun sound.
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