Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

You see,its not damaging but theres no any error any one knows why?

local Dude = game.Players.LocalPlayer

mouse = Dude:GetMouse()

Char = Dude.Character

local debounce = false

  

mouse.KeyDown:connect(function(key)

if key == "e" then

if not debounce then

debounce = true

--Variables

local Touch = false

local FireBall = Instance.new("Part")

local Mesh = Instance.new("SpecialMesh")

local Fire = Instance.new("Fire")

local BodyVelocity = Instance.new("BodyVelocity")

--Parent

BodyVelocity.Parent = FireBall

FireBall.Parent = workspace

Fire.Parent = FireBall

Mesh.Parent = FireBall

--Characteristic

FireBall.CanCollide = false

BodyVelocity.MaxForce = Vector3.new(4000,4000,4000)

BodyVelocity.P = 1205

BodyVelocity.Velocity = Char.HumanoidRootPart.CFrame.lookVector*100

FireBall.Transparency = 0.8

FireBall.BrickColor = BrickColor.new("Really red")

Mesh.MeshType = "Sphere"

FireBall.Size = Vector3.new(1.17, 1.17, 1.17)

--Cframes

FireBall.CFrame = Char:FindFirstChild("RightHand").CFrame

--Damage Script Cause idk

FireBall.Touched:connect(function(Hit)

local Hum = Hit.Parent:FindFirstChild("Humanoid")

if Hum == nil then return end

if Touch == false then

Touch = true

if Hum.Parent == Char then

print("FriendlyFire IS OFF YOU HEAR ME!?")

else

Hit.Humanoid.Health = Hit.Humanoid.Health -50

end

end

end)

--Raf dont get confuse at this

wait(2)

FireBall:Destroy()

debounce = false

end

end

end)

So ugh if you know what's causing the problem and tell why thank you also im really hecka confuse so help me out!

1 comment

0

Are you assuming the player's gender by naming the LocalPlayer variable "Dude"?

2 answers

✓ Accepted answer

Your code is messy and I can't really read it. Try to replace your damage portion with this code:

local Debounce = true
FireBall.Touched:Connect(function(Hit)
	if Hit.Parent ~= Char and Hit.Parent:FindFirstChild('Humanoid') and Debounce then
		Debounce = false
		Hit.Parent.Humanoid:TakeDamage(50)
		wait(5)
		Debounce = true
	end
end)

Also I noticed that you are using a LocalScript. Make sure you use the ServerScript if you want it to actually work. Use RemoteEvents to connect with the server.

PS:

  1. Use RemoteEvents
  2. Make sure to use UserInputService
  3. Avoid Global Variables 4.:Connect over :connect
  4. use better variable names

2 comments

0

nope this damages the local player and not the player that is being targeted

0

It doesn't because it checks if it doesn't. I'm not gonna lie you are a terrible scripter

i got it to fully work aka kill the other player and not urself, but i dont feel like explaining and i barely understand it myself so if u want it without me breaking the rules of this site add me on discord world killer#4891

This discussion is preserved as it was. New answers, comments, and votes are closed.