local hopperbin = script.Parent
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local character = player.Character
local bullets = workspace.Bullets
local reloadTime = .1
local spread = 1
local recoil = 1
local fire = false
local firing = false
local bulletSpeed = 250
local bulletDrop = 0
local bursts = 25
local distance = 125
_G.shooterSelected = (function(mouse)
mouse.Icon = "http://www.roblox.com/asset/?id=15324984"
**
*--This is copied from Automatic hopperbin local script--***
mouse.Button1Down:connect(function()
clicked(mouse)
end)
mouse.Button1Up:connect(unClicked)
mouse.KeyDown:connect(_G.animateKeyPressed)
end)
function clicked(mouse)
local gun = camera.Gun
if (character.Humanoid.Health > 0) then
if (not fire) then
fire = true
firing = true
while (firing) do
local head = character.Head
local startPos = (gun.CFrame * CFrame.new(0, -2, 0)).p
local endPos = (camera.CoordinateFrame * CFrame.new(0, 0, -100)).p
local distance = (endPos - startPos).magnitude
local random = Vector3.new((math.random(-spread, spread) / 250) * distance, (math.random(-spread, spread) / 250) * distance, (math.random(-spread, spread) / 250) * distance)
local shot = gun.Fire
if (not _G.sighted) then
_G.fireBullet("Automatic", startPos, endPos + random, 100, bulletSpeed, bulletDrop, player.TeamColor, bullets)
else
_G.fireBullet("Automatic", startPos, endPos, 100, bulletSpeed, bulletDrop, player.TeamColor, bullets)
end
recoilCam()
shot:play()
wait(0.1)
end
delay(reloadTime, (function() fire = false end))
end
end
end
function unClicked()
firing = false
end
function recoilCam()
coroutine.resume(coroutine.create(function()
camera.Focus = camera.Focus + Vector3.new(0, recoil / 100, 0)
local interval = 20
for i = 1, interval do
wait(0.01)
camera.Focus = camera.Focus - Vector3.new(0, (recoil / 100) / interval, 0)
end
end))
end
hopperbin.Selected:connect(_G.shooterSelected)
COMMUNITY QUESTION
Does Anyone know how to script a Paintball Sentry with projectiles and raycasting with hopperbins?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
So what's the issue here? What doesn't work?