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

How can I prevent the player from getting damage from the player's fireball?

So I asked this again because last time when I posted this question, no one can understand what is actually my question. So I won't like the player getting damage from his own fireball. Even this line of codes won't work, it just disables the damage script.

local B = Instance.new("Part")
local DAMAGE = game.Lightning.Damage:Clone()
DAMAGE.Parent = B
local owner = game.Players.LocalPlayer.Character
DAMAGE.Enabled = false

3 comments

0

give the full script so i can help

0

Why is your fireball in Lighting?

0

you can just say if hit.Parent ~= player.Character then (deal damage) end. Also the damage code is in some other script in your game.

1 answer

To prevent players from unintentionally committing suicide, you must use an if statement and touched event to see what the fireball touched. When the touched event gets fired, it gives an argument which is the instance that it touched. To determine whether it is the player, you need to use an if statement and IsDescendantOf function. Put this somewhere in your code, you didn't put all your code so I could not tell you specifically where.

if TouchedObj:IsDescendantOf(Character) then return end

1 comment

0

Do i have to changed touchedobj?

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