Hi, I've recently started learning scripting, I've been trying to solve this on my own for a while now but no luck. I don't know where the error is so I'll attach the local script and the server script so hopefully someone can help me. Right now I'm just trying to get the aiming done for the "SmallFireball" So ignore the "LargeFireball" remote event.
----------- Local Script -------------
-- Services --
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local UserInputService = game:GetService("UserInputService")
-- Variables --
Player = game.Players.LocalPlayer
repeat wait() until Player.Character
Character = Player.Character
Mouse = Player:GetMouse()
-- Settings --
IsTyping = false
ButtonDown = false
Key = nil
FireballCooldown = false
-- Script --
UserInputService.TextBoxFocused:Connect(function() -- User typing
IsTyping = true
end)
UserInputService.TextBoxFocusReleased:Connect(function() -- User stopped typing
IsTyping = false
end)
UserInputService.InputBegan:Connect(function(InputObj, gameProcessedEvent) -- Q is down
if IsTyping == true then return end
if InputObj.KeyCode == Enum.KeyCode.Q then Key = "Q"
ButtonDown = true
local timepassed = tick()
while ButtonDown == true do
wait()
if ButtonDown == false and tick() - timepassed < 3 and FireballCooldown == false then FireballCooldown = true print(tick() - timepassed) script.SmallFireball:FireServer(Mouse.Hit) print("small fireball fired") wait(2) FireballCooldown = false else -- Charging system small fireball
if ButtonDown == false and tick() - timepassed >= 3 then FireballCooldown = true print(tick() - timepassed) script.LargeFireball:FireServer(Mouse.Hit) print ("large fireball fired") wait(8) FireballCooldown = true end -- Charging system large fireball
end
UserInputService.InputEnded:connect(function(InputObject, gameProcessedEvent) -- Q is up which turns ButtonDown to false
if InputObject.KeyCode == Enum.KeyCode.Q and Key == "Q" then
ButtonDown = false
end
end)
end
end
end)
----------Server Script for SmallFireball event----------
script.Parent.OnServerEvent:Connect(function(Player, Hit)
local character = Player.Character or Player.CharacterAdded:Wait()
local Fireball = Instance.new('Part')
Fireball.Shape = Enum.PartType.Ball
Fireball.Parent = workspace.Projectiles
Fireball.CFrame = character.RightHand.CFrame
local ray = Ray.new(character.RightHand.Position, (Hit.Position).unit *10)
local BodyPosition = Instance.new("BodyPosition")
BodyPosition.Parent = Fireball
local IntersectedObject, position = workspace:FindPartOnRay(ray, character)
print(position)
BodyPosition.Position = position*5
BodyPosition.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
game:GetService("Debris"):AddItem(Fireball, 20)
end)
I've been trying with both BodyVelocity and BodyPosition but both didn't work for me. I appreciate any help you can give me.

3 comments
Where's the local scripts location?
The local script is inside of starterpack
Like, the sphere shoots, but its very inaccurate when it comes to aim.