how to make a reflect part that u deal damage to the part the damage come back to you
when you damage the part, make a check that checks if it reflects, and if it does then damage the player that dealt the damage (you).
deal damage >> if reflect then >> reflect damage >> end
how to make the reflect damage script?
and tutorial or something? idk that
For example:
You have a Sword. In the Sword, there a Boolean value that is set to false.
When you are hitting your enemy with the sword but He use Reflect/Protect, Set the Boolean value to true and Deal damage to yourself instead.
how to make the script dealing damage to yourself
like if Enemy.Value == true then
i take damage?
There is a inbuilt function in Roblox’s API that allows you to damage players using their Humanoid. That function is :TakeDamage()
Here’s an example:
--Put this in a server script!
game:GetService("Players").PlayerAdded:Connect(function(Player)
local Character = Player.Character or Player.CharacterAdded:Wait() --Get the character, or wait for the character to load.
local Humanoid = Character:WaitForChild("Humanoid") --Wait for the Humanoid
local DamageToTake = 20 --How much HP you want to be removed.
Humanoid:TakeDamage(DamageToTake)
end)
In summary, use the Humanoid and then the given function :TakeDamage()
(inside the brackets how much HP you want to be removed) to damage a player.