|
| 03 Jan 2013 02:13 PM |
| How do script one? I see the one of the wiki, and i understand that one.. But.. Not an automatic one.. Also.. How do i do ammo on a gun too? |
|
|
| Report Abuse |
|
|
| |
|
Xtreme101
|
  |
| Joined: 03 Jan 2009 |
| Total Posts: 4385 |
|
|
| 03 Jan 2013 02:19 PM |
| Scripting Helpers, not Scripting Slaves. Get lost. |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2013 02:40 PM |
| .... I was asking for help thank you very much... And.. Is it while mousebutton1 and it firing? Or.. Is it couroutines? |
|
|
| Report Abuse |
|
|
zars15
|
  |
| Joined: 10 Nov 2008 |
| Total Posts: 9999 |
|
|
| 03 Jan 2013 02:41 PM |
| .....It should be as simple as making while loop that does firing until you release left mouse button. |
|
|
| Report Abuse |
|
|
|
| 03 Jan 2013 02:44 PM |
Yep, coroutines.
local firing = false
mouse.Button1Down:connect(function() firing = true end)
mouse.Button1Up:connect(function() firing = false end)
coroutine.resume(coroutine.create(function() while wait(1) do if firing then --Fire bullets here end end end)) |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Jan 2013 07:54 PM |
This is what i got so far..
Main firing script;
local tool = script.Parent local user
--when the tool is equipped tool.Equipped:connect(function(mouse) --store the character of the person using the tool user = tool.Parent --when the left mouse button is clicked while true do wait(.3) --make and do a hit test along the ray local ray = Ray.new(tool.Barrel.CFrame.p, (mouse.Hit.p - tool.Barrel.CFrame.p).unit*300) local hit, position = game.Workspace:FindPartOnRay(ray, user) --do damage to any humanoids hit local humanoid = hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") if humanoid then humanoid:TakeDamage(10) end --draw the ray local distance = (position - tool.Barrel.CFrame.p).magnitude local rayPart = Instance.new("Part", user) rayPart.Name = "RayPart" rayPart.BrickColor = BrickColor.new("Bright red") rayPart.Transparency = 0.3 rayPart.Anchored = true rayPart.CanCollide = false rayPart.TopSurface = Enum.SurfaceType.Smooth rayPart.BottomSurface = Enum.SurfaceType.Smooth rayPart.formFactor = Enum.FormFactor.Custom rayPart.Size = Vector3.new(0.1, 0.1, distance) rayPart.CFrame = CFrame.new(position, tool.Handle.CFrame.p) * CFrame.new(0, 0, -distance/2) --add it to debris so it disappears after 0.1 seconds game.Debris:AddItem(rayPart, 0.1) end end)
Local gui script;
local Tool = script.Parent;
--wait(.5) --mouse.Icon = "rbxasset://textures\\GunCursor.png" --enabled = true --mouse.Button1Up:connect(function() onButton1Up(mouse) end)
Tool.Enabled = false
function onButton1Up(mouse) Tool.Script.Disabled = true Tool.Enabled = false wait(2.2) end function onButton1Down(mouse) Tool.Script.Disabled = false Tool.Enabled = true end function onEquippedLocal(mouse)
if mouse == nil then print("Mouse not found") return end
mouse.Icon = "rbxasset://textures\\GunCursor.png" mouse.Button1Down:connect(function() onButton1Down(mouse) end) mouse.Button1Up:connect(function() onButton1Up(mouse)end) end
Tool.Equipped:connect(onEquippedLocal)
This works fine in studio-visit mode.. But.. It doesn't work on online places..
|
|
|
| Report Abuse |
|
|
|
| 05 Jan 2013 08:11 PM |
| ...? I really have no clue.. >_> |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 06 Jan 2013 02:01 AM |
| ..................................................................................................................................................................................................................................................................................................... |
|
|
| Report Abuse |
|
|
|
| 06 Jan 2013 02:02 AM |
| uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu==pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp |
|
|
| Report Abuse |
|
|
|
| 07 Jan 2013 06:30 PM |
| -_-" Sad that only a troll can answer me.. How about some scripters, eh? |
|
|
| Report Abuse |
|
|