|
| 31 Jul 2013 06:25 PM |
| How do you make a script that shoots a part right infront of you on activated? |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 31 Jul 2013 06:26 PM |
| Well if you want it to shoot like a fire arm then use Raycasting. Otherwise you can use Velocity and lookVector to accomplish this. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
ToboboT
|
  |
| Joined: 25 Jun 2011 |
| Total Posts: 2385 |
|
|
| 31 Jul 2013 06:32 PM |
| No you can't this is scripting helpers not scripters give you scripts |
|
|
| Report Abuse |
|
|
| |
|
|
| 31 Jul 2013 06:34 PM |
| Can you at least help my im new to scripting |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 31 Jul 2013 07:03 PM |
| "This is scripting helpers not scripting givers" |
|
|
| Report Abuse |
|
|
| |
|
| |
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 31 Jul 2013 08:00 PM |
No one has helped you the last 8 bumps, were not going to just code it for you.
Try to figure it out with these tutorials:
http://wiki.roblox.com/index.php/How_to_Make_a_Raycasting_Lasergun
http://wiki.roblox.com/index.php/LookVector#Properties |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Aug 2013 06:08 AM |
| Can some help me with look vector? |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2013 06:23 AM |
| What do you not understand? |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Aug 2013 07:59 AM |
| Okay... What part of scripting do you understand? |
|
|
| Report Abuse |
|
|
|
| 01 Aug 2013 08:43 AM |
for i function while true do properties wait(1) operators prints cmommands strings tables bools values |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Aug 2013 09:44 AM |
This is only nessecary if you want a flashlight attachment.
tool = script.Parent plr = game.Players.LocalPlayer script.Parent:WaitForChild("plr").Value = plr
mouse = nil con = nil on = false
tool.Equipped:connect(function(mse) mouse = mse mouse.Icon = "rbxasset://textures\\GunCursor.png" con = mouse.KeyDown:connect(function(key) if key =="l" then -- Press "l" to disable and enable light. if on then script.Parent.Handle.SpotLight.Enabled = false on = false else script.Parent.Handle.SpotLight.Enabled = true on = true wait(800) script.Parent:remove() end end end) end) tool.Unequipped:connect(function() con:disconnect() end)
script.Parent.Reloading.Changed:connect(function() if script.Parent.Reloading.Value then mouse.Icon = "rbxasset://textures\\GunWaitCursor.png" else mouse.Icon = "rbxasset://textures\\GunCursor.png" end end)
This is the gun script. local tool = script.Parent local reloading = script.Parent.Reloading
function fire(d) bullet = Instance.new("Part") bullet.FormFactor = "Custom" bullet.Size = Vector3.new(0.4,0.2,0.2) bullet.BrickColor = BrickColor.new("Really black") bullet.Position = tool.Handle.Position + (d*5) bullet.Velocity = d*100 bullet.Touched:connect(function(hit) bullet:remove() chr = hit.Parent if game.Players:GetPlayerFromCharacter(chr) and chr:findFirstChild("Humanoid") then plr = game.Players:GetPlayerFromCharacter(chr) if chr.Humanoid.Health > 0 then chr.Humanoid:TakeDamage(math.random(10,20)) end end end) force = Instance.new("BodyForce") force.force = Vector3.new(0,3,0) force.Parent = bullet
bullet.Parent = game.Workspace end tool.Activated:connect(function() if tool.Enabled and not reloading.Value then chr=tool.Parent if game.Players:GetPlayerFromCharacter(chr)==script.Parent.plr.Value then if chr:findFirstChild("Humanoid") then if chr.Humanoid.Health >0 then reloading.Value = true hum = chr.Humanoid targetPos = hum.TargetPoint lookAt = (targetPos-chr.Head.Position).unit fire(lookAt) wait(0.5) reloading.Value = false end end end end
end)
There you go! ;)
|
|
|
| Report Abuse |
|
|