I recently started scripting and I decided to try to make a fireball(tool) that launches when I click,
This local script is in StarterPack, it's the tool's child:
local tool = script.Parent
local remote = game:GetService("ReplicatedStorage"):WaitForChild("FireballTool")
tool.Equipped:connect(function(mouse)
mouse.Button1Down:connect(function()
remote:FireServer()
end)
end)
and this script is in ServerScriptService:
Player = game.Players.LocalPlayer
local remote = game:GetService("ReplicatedStorage"):WaitForChild("FireballTool")
remote.OnClientEvent:Connect(function(Player)
local fireball = Instance.new("Part")
fireball.BrickColor = BrickColor.new("Maroon")
fireball.Transparency = 0.4
fireball.Shape = "Ball"
fireball.TopSurface = "Smooth"
fireball.BottomSurface = "Smooth"
fireball.CanCollide = false
fireball.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new (2,1,9)
local bv = Instance.new("BodyVelocity",fireball)
bv.Velocity = Player.Character.HumanoidRootPart.CFrame.lookVector * 85
bv.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
fireball.Parent = workspace
wait(2)
fireball:remove()
end)
(yes, I put a remote event called FireballTool in ReplicatedStorage) I don't know what I did wrong and why the error " OnClientEvent can only be used on the client" shows up, please help?

1 comment
On line 3, instead of "OnClientEvent" it should say "OnServerEvent"