local Ball = game.Workspace.Ball
local UIS = game:GetService("UserInputService")
local Fire = game.ReplicatedStorage.Fire
local Player = game.Players.LocalPlayer
local Character = Player.Character
BodyVelocity = Instance.new("BodyVelocity")
BodyVelocity.Parent = Ball
Ball.Parent = game.Workspace
local Mouse = game.Players.LocalPlayer:GetMouse()
UIS.InputBegan:Connect(function(input) if input.KeyCode == Enum.KeyCode.E then local Character = Player.Character Ball.Shape = Enum.PartType.Ball if Character then Ball.CFrame = Player.Character.HumanoidRootPart.CFrame*CFrame.new(0,0,-2) Fire:FireServer(Mouse.Hit.p) end end end)
that's the localside and the server side is local BallofFire = game.StarterPlayer.StarterPlayerScripts.BallofFire Fire = game.ReplicatedStorage.Fire local UIS = game:GetService("UserInputService")
Ball = game.Workspace.Ball
Ball.Parent = workspace
BodyVelocity = Instance.new("BodyVelocity") BodyVelocity.Parent = Ball
Fire.OnServerEvent:Connect(function(PlayerWhoFired, MousePosition) for i = 1,9 do
Ball.Anchored = true
Ball.CanCollide = false
Ball.Transparency = 0.5
BodyVelocity.MaxForce = Vector3.new(20,20,20)
BodyVelocity.Velocity= Vector3.new(MousePosition -PlayerWhoFired.Character.PrimaryPart.Position.Unit*30)
wait() end
end) theres a remoteevent obviously but I cant make the fireball to shoot why?(I treid debugging it)
Here's a few things, you never want to create instances / do things you want people to see via the client, I'll assist you.
-- >> Client local UIS = game:GetService("UserInputService") local Fire = game.ReplicatedStorage.Fire local Player = game.Players.LocalPlayer local Character = Player.Character local mouse = Player:GetMouse() local deb = false UIS.InputBegan:Connect(function(input, isTyping) if isTyping then return end if input.KeyCode == Enum.KeyCode.E and not deb then deb = true Fire:FireServer(Mouse.Hit) wait(1) deb = false end end) -- >> Server local Fire = game.ReplicatedStorage.Fire local deb = false Fire.OnServerEvent:Connect(function(plrWhoFired, Mouse) local char = plrWhoFired.Character or plrWhoFired.CharacterAdded:Wait() local Part = Instance.new('Part') -- instancing on the server Part.Shape = Enum.PartType.Ball Part.CanCollide = false Part.Transparency = 0.5 Part.Parent = workspace Part.CFrame = char.HumanoidRootPart.CFrame local bodyVelocity = Instance.new("BodyVelocity") -- allows it to shoot bodyVelocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge) bodyVelocity.Velocity = Mouse.LookVector*30 bodyVelocity.Parent = Part Part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild('Humanoid') and hit.Parent.Name ~= plrWhoFired.Name and not deb then -- checks to ensure its a player, and not you deb = true local otherPlr = hit.Parent.Humanoid otherPlr:TakeDamage(50) -- amount you want to damage them Part:Destroy() wait(1) deb = false end end) end)