|
| 15 Jul 2014 10:24 AM |
local Tool = script.Parent; local mouse = game.Players.LocalPlayer:GetMouse() local Down = false
enabled = true
local spark = Instance.new("Sparkles") spark.Color = Color3.new(0,1,0)
function fire(v)
local vCharacter = Tool.Parent local vPlayer = game.Players:playerFromCharacter(vCharacter)
local missile = Instance.new("Part")
spark:Clone().Parent = missile
local spawnPos = vCharacter.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=11944350" PewPew.Parent = Tool.Handle PewPew.Volume = 1 end
spawnPos = spawnPos + (v * 10)
missile.Position = spawnPos missile.Size = Vector3.new(1,1,1) missile.Velocity = v * 150 missile.BrickColor = BrickColor.new(1020) missile.Shape = 0 missile.BottomSurface = 0 missile.TopSurface = 0 missile.Name = "Spark" missile.Reflectance = .5
local force = Instance.new("BodyForce") force.force = Vector3.new(0,98,0) force.Parent = missile
local creator_tag = Instance.new("ObjectValue") creator_tag.Value = vPlayer creator_tag.Name = "creator" creator_tag.Parent = missile
local new_script = script.Parent.LaserBlast:clone() new_script.Disabled = false new_script.Parent = missile
missile.Parent = game.Workspace
PewPew:Play()
end
function gunUp() Tool.GripForward = Vector3.new(0,.981,-.196) Tool.GripRight = Vector3.new(1,0,0) Tool.GripUp = Vector3.new(0,.196,.981) end
function gunOut() Tool.GripForward = Vector3.new(0,1,0) Tool.GripRight = Vector3.new(1,0,0) Tool.GripUp = Vector3.new(0,0,1) 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:WaitForChild("Humanoid") if humanoid == nil then print("Humanoid not found") return end
local targetPos = humanoid.TargetPoint local lookAt = (targetPos - character.Head.Position).unit
local reload = .1
gunUp() fire(lookAt) wait(reload) gunOut() wait(reload)
enabled = true
end
function onEquipped() Tool.Handle.EquipSound:play() mouse.Button1Down:connect(function() Down = true while Down == true do wait() onActivated() end end) mouse.Button1Up:connect(function() Down = false end) end
script.Parent.Equipped:connect(onEquipped)
So, I turned this into a automatic gun. It works, but if you click around on the screen before you equip it, it won't fire. No output. Or vice versa if you equip it then unequip it then click around.... |
|
|
| Report Abuse |
|
|
| 15 Jul 2014 10:27 AM |
| Btw the line I changed is near the bottom with the equipped function. |
|
|
| Report Abuse |
|
| |
|
| 15 Jul 2014 10:37 AM |
Line on top with the semicolon?
This isn't Javascript sir. :p |
|
|
| Report Abuse |
|
| |