I've been trying to make a game that is similar to Elemental Battlegrounds. I got a HopperBin, and a script I made. The problem is that it won't shoot. Anyone got any ideas?
local me = game.Players.LocalPlayer
local tool = script.Parent
local ws = game:GetService("Workspace")
tool.Selected:connect(function(mouse)
mouse.Button1Down:connect(function()
handle = me.Character.Torso
local p = Instance.new("Part")
p.CFrame = CFrame.new(handle.Position)
p.TopSurface = "Smooth"
p.BottomSurface = "Smooth"
p.Shape = Enum.PartType.Ball
p.Size = Vector3.new(2,2,2)
p.CanCollide = false
p.BrickColor = BrickColor.new("Really red")
p.Parent = ws
local bv = Instance.new("BodyVelocity")
bv.Parent = p
bv.velocity = (mouse.Hit.p - handle.Position).unit*90
p.Touched:connect(function(hit)
if hit.Parent.Name ~= me.Character.Name then
hit.Parent.Humanoid:TakeDamage(5)
end
end)
game:GetService("Debris"):AddItem(p, 7)
end)
end)

1 comment
lmao i got the answer that i wanted but there's more than 1 mistake