local UserInput = game:GetService("UserInputService") local offset = Vector3.new(0,0,-3) local player = game.Players.LocalPlayer local Character = player.Character or player.CharacterAdded:wait() local rootpart = Character:WaitForChild("HumanoidRootPart",3) local FireBallEvent = game.ReplicatedStorage.FireBallEvent UserInput.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.R then print("You pressed R") local CreateFireBall = Instance.new("Part", workspace) CreateFireBall.Shape = "Ball" CreateFireBall.Size = Vector3.new(5,5,5) CreateFireBall.Anchored = true CreateFireBall.CanCollide = true CreateFireBall.BrickColor = BrickColor.new("Really red") CreateFireBall.CFrame = rootpart.CFrame * CFrame.new(offset) while true do wait(.001) CreateFireBall.CFrame = CreateFireBall.CFrame * CFrame.new(offset) end CreateFireBall.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local character = hit.Parent FireBallEvent:FireServer(character) end end) end end)
that is the server script, the event is call FireBallEvent
local FireBallEvent = game.ReplicatedStorage.FireBallEvent FireBallEvent.OnServerEvent:Connect(function(player, character) character.Humanoid.Health = character.Humanoid.Health -5 end)
and that is the local script, for some reason this wont work help! The fireball comes out and moves but it doesnt do damage upon hitting a dummy. No errors come up either
bruh i see the problem in ur server script the server thinks character is the player u should write Player.Character instead and u dont need to apply any name to the FireServer() as the player who fires the server is already outputted like example script in last part of local script (Also u need to put touch in server or wont work
UserInput.InputBegan:connect(function(input) if input.KeyCode == Enum.KeyCode.R then print("You pressed R") local CreateFireBall = Instance.new("Part", workspace) CreateFireBall.Shape = "Ball" CreateFireBall.Size = Vector3.new(5,5,5) CreateFireBall.Anchored = true CreateFireBall.CanCollide = true CreateFireBall.BrickColor = BrickColor.new("Really red") CreateFireBall.CFrame = rootpart.CFrame * CFrame.new(offset) FireBallEvent:FireServer(CreateFireBall) local Veloc = instance.New("Body Velocity",CreateFireBall) Veloc.Velocity = game.Player.LocalPlayer.Character.Torso.CFrame.LookVector * 60 -- You can use a body velocity here instead of the offset like end end end)
and for ur server script
local FireBallEvent = game.ReplicatedStorage.FireBallEvent FireBallEvent.OnServerEvent:Connect(function(player,part) local tr = true local E = true wait (0.2) -- incase it touches twice and deals double dmg local tr = true part.Touched:connect(function(OtehPart) if OtehPart.Parent:FindFirstChild("Humanoid") and E and tr then OtehPart.Parent.Humanoid:TakeDamage(5) end)
i hoped this helped