So I need the ball to shoot out of the sword when a player clicks using their mouse.This is the script i tried. I think it works but i dont know how to activate it when somebody clicks with their mouse can somebody please help.
script.Parent.Connect:OnMouseButton1Click(ball)
function ball(b)
local Tool = script.Parent
local boi = Tool.Parent
local girl = game.Players:playerfromcharacter(boi)
local missile = Instance.new("Part")
local spawnpos = boi.PrimaryPart.Position
spawnpos = spawnpos + (b * 10)
missile.Position = spawnpos
missile.Size = Vector3.new(4,4,4)
missile.Velocity = b * 10
missile.BrickColor = BrickColor.new(1004)
missile.Shape = 0
missile.BottomSurface = 0
missile.TopSurface = 0
missile.Name = "missile"
missile.Reflectance = 0
local force = Instance.new("BodyForce")
force.force = Vector3.new(0,98,0)
force.Parent = missile
local creatortag = Instance.new("ObjectValue")
creatortag.Value = girl
creatortag.Name = "creator"
creatortag.Parent = missile
missile.Parent = game.Workspace
end

2 comments
:playerfromcharacter isn't a function. also, onMouseButton1Click isn't a built-in-function either.
Also, Connect should be :Connect not .Connect