So i recently made a gojo reversal red script and i have been having this problem to not make the hitbox damage part go to the player and make the player doing it get no damage from other players. So honestly i have no idea
I did manage to do a thing that works but its broken and easily bypassable
i havent seen any articles about it so i would like to know if there is way to because not even going on most free models i found actual solutions
also heres the code images and videos about my problem:
local part = script.Parent
local db = false
part.Touched:Connect(function(touched)
if db == false then
db = true
local hum = touched.Parent:FindFirstChild("Humanoid")
hum:TakeDamage(20)
wait(3)
db = false
end
end)
im looking for the hitbox part that i made not deal damage while u can also not lose damage but it being a better way than i did seeing if there are any other methods out there
I need to see the way your code is organized, but I would try setting an attribute to the hitbox called “Owner” or smth like that and pass in the players username then get that attribute in your hit function and then use game.Players:GetPlayerFromCharacter function to determine whether or not its touching the owner of that attack.
yes thats what i was aiming for but i also wanted it so the player cant get damage from others or else it would interrupt the ability. Also heres the local script code for more context:
local player = game.Players.LocalPlayer
local chara = player.Character
local tool = script.Parent
local players = game.Players
local re = script.RemoteEvent
local canab = game.ReplicatedStorage.Values.CanAbility
local mouse = player:GetMouse()
if canab.Value == false then
if mouse.Target and mouse.Target.Parent:FindFirstChild("Humanoid") then
local thum = mouse.Target.Parent:FindFirstChild("HumanoidRootPart")
canab.Value = true
if canab.Value == true then
tool.Activated:Connect(function()
chara:WaitForChild("HumanoidRootPart").CFrame = thum.CFrame * CFrame.new(0, 0, -5)
end)
end
end
end
local animationId = "99910051876265"
local animationPriority = Enum.AnimationPriority.Action
local function playAnimation(player)
local character = player.Character
local humanoid = character:FindFirstChild("Humanoid")
if humanoid then
local animation = Instance.new("Animation")
animation.AnimationId = "rbxassetid://" .. animationId
local animationTrack = humanoid:LoadAnimation(animation)
animationTrack.Priority = animationPriority
animationTrack:Play()
end
end
local db = false
function toolActivation()
if db == false then
db = true
if canab.Value == true then
script.Parent.Handle.gr:Play()
local Player = game.Players:GetPlayerFromCharacter(tool.Parent)
if Player then
playAnimation(Player)
end
re:FireServer(tool)
end
wait(10)
db = false
end
end
tool.Activated:Connect(toolActivation)
also the values:
It’s not finished the script so ingnore the mouse part i was gonna make so it teleports to the player and yes its working, aswell as the vfx from the explosion will be modified.
That’s what I said earlier that you set an attribute for the damage part and set the value to the player who did the attacks name I’ll send some code later
Sorry my timezone is diferent so at the time i had to sleep, so ok i will try it, i thought u were saying to put a script to detect the attack being done ( thats why i made it in health for the two ) so like you’re saying i might just need to add attributes and it really is the best way. Also sorry if my grammar is bad im brazilian and new to the devforum i just wanted to know if there was any better way to do than that, but there isn’t much more and i might just end this thread so yeah thanks for helping me