#help with my part

1 messages · Page 1 of 1 (latest)

burnt sedge
#

task.wait(0.55)

            local hrp = plr.Character:FindFirstChild("HumanoidRootPart")

            local hitbox = Instance.new("Part")
            hitbox.Size = Vector3.new(5, 10, 5)
            hitbox.Transparency = 0.5
            hitbox.BrickColor = BrickColor.new("Really red")
            hitbox.CanCollide = false
            hitbox.Anchored = false
            hitbox.CFrame = hrp.CFrame
            hitbox.Parent = workspace  -- altijd in Workspace voor physics stabiliteit

            -- WeldConstraint zodat hij meebeweegt
            local weld = Instance.new("WeldConstraint")
            weld.Part0 = hrp
            weld.Part1 = hitbox
            weld.Parent = hitbox
            weld.C0 = CFrame.new(0, 0, 0)
                    
            game.Debris:AddItem(hitbox, 1)
            
            local WaterTornadoVFX = game.ReplicatedStorage.VFX.WaterTornadoVFX:Clone()

yo im creating a part i want to add the hitbox to my character, but everytime i add it, it glitching out. I want the hitbox to move with the character.

ebon hinge
#

alr

burnt sedge
ebon hinge
#

is the code you showed inside a while loop? that might be it

burnt sedge
#

no

#

i just pressed the button twice

ebon hinge
#

and did you also remember to destroy the hitbox after the animation ends?

#

oh

#

yeah you just forgot to destroy the hitbox then

cosmic jacinth
#

i sent code

#

dm

#

bro

burnt sedge
burnt sedge
#

made a dumb mistake in code

ebon hinge
#

np

burnt sedge
#

elseif Argument == "three" then
spawn(function()
plr.Character.Humanoid.WalkSpeed = 16 -- zorgt voor een stun nadat je hebt geslagen
task.wait(0.1)
plr.Character.Humanoid.WalkSpeed = 16
end)

            local hrp = plr.Character:FindFirstChild("HumanoidRootPart")

            local hitbox = Instance.new("Part")
            hitbox.Anchored = false
            hitbox.Size = Vector3.new(5, 10, 5)
            hitbox.Transparency = 0.5
            hitbox.BrickColor = BrickColor.new("Really red")
            hitbox.CanCollide = false
            hitbox.CFrame = hrp.CFrame
            hitbox.Parent = workspace  -- altijd in Workspace voor physics stabiliteit

            -- WeldConstraint zodat hij meebeweegt
            local weld = Instance.new("WeldConstraint")
            weld.Part0 = hitbox
            weld.Part1 = hrp
            weld.Parent = hitbox
            weld.C0 = CFrame.new(0, 0, 0)
                
            game.Debris:AddItem(weld, 1)    
            game.Debris:AddItem(hitbox, 1)
#

local WaterTornadoVFX = game.ReplicatedStorage.VFX.WaterTornadoVFX:Clone()

            local rootAttachment = hrp:FindFirstChild("RootAttachment")

            spawnVFX(game.ReplicatedStorage.VFX.WaterTornadoVFX, hrp.CFrame)


            local hitboxcooldown = false
            hitbox.Touched:Connect(function(hit)
                if hit.Parent.Name ~= plr.Name and hit.Parent:FindFirstChild("Humanoid") then
                    if hitboxcooldown == true then return end
                    hitboxcooldown = true
                    
                    hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)

                    if cooldown == true then return end
                    if lastcooldown == true then return end

                    spawn(function()
                        cooldown = true
                        cooldown = false
                    end)


                    local BV = Instance.new("BodyVelocity")
                    BV.MaxForce, BV.Velocity = Vector3.new(5e4, 5e2, 5e4), plr.Character.HumanoidRootPart.CFrame.LookVector * 10
                    BV.Parent = hit.Parent.HumanoidRootPart
                    game.Debris:AddItem(BV, 0.16)

                    local bool = Instance.new("BoolValue") -- dit geeft een boolvalue aan de enemy, die stun heet
                    bool.Name = "Stunned"
                    bool.Parent = hit.Parent
                    game.Debris:AddItem(bool,1)

                    task.wait(1) -- !nog wellicht veranderen
                    hitboxcooldown = false
                end
            end)
        end
    end)
burnt sedge
#

still got the glitch

#

with the hitbox

#

the walkspeed was not the problem

cosmic jacinth
#

why

#

It would be easier if you didnt have chatpgt write the code

ebon hinge
#

You probably shouldn't be using Debris when doing hitboxes

cosmic jacinth
#

obv chatgpt made this code

ebon hinge
#

Just manually destroy the hitbox

#

with :Destroy()

cosmic jacinth
#

no

#

if hitbox will appear again

#

you cant use destroy

#

bro

burnt sedge
ebon hinge
#

waiit

burnt sedge
#

i made it with a youtube tutorial

cosmic jacinth
#

oh

shadow wingBOT
#

studio** You are now Level 1! **studio

burnt sedge
#

and tried some other things my self

cosmic jacinth
#

it looks like ai code

#

nvm

ebon hinge
#

could this be because theres no cooldown to the ability?

cosmic jacinth
ebon hinge
#

k

burnt sedge
#

yeah the hitbox is not the problem

#

look

cosmic jacinth
#

king

#

you said hitbox

#

destroying

#

is it appear second use

burnt sedge
#

look when i start spinning

#

it is glitching out

ebon hinge
#

this definitely has to do with destroying the hitbox and the cooldown

cosmic jacinth
ebon hinge
#

ooooh wait

cosmic jacinth
burnt sedge
cosmic jacinth
#

hitbox already destroying btw

ebon hinge
#

i think he means the snapping the charchter is doing

cosmic jacinth
burnt sedge
cosmic jacinth
#

wallah

#

i cant understand

#

what happening character

#

hitbox need rotate with character???

ebon hinge
#

when he activates the ability, the charachter does one step forward

#

as if the script moved the hrp by one singular inch

cosmic jacinth
#

its about animation

ebon hinge
#

HRP position

cosmic jacinth
#

send code

#

king

burnt sedge
#

alright

#

imma send another video

#

so that yk what i mean

ebon hinge
#

thats definitely the wrong one

burnt sedge
#

elseif Argument == "three" then
spawn(function()
plr.Character.Humanoid.WalkSpeed = 16 -- zorgt voor een stun nadat je hebt geslagen
task.wait(0.1)
plr.Character.Humanoid.WalkSpeed = 16
end)

            local hrp = plr.Character:FindFirstChild("HumanoidRootPart")

            local hitbox = Instance.new("Part")
            hitbox.Anchored = false
            hitbox.Size = Vector3.new(5, 10, 5)
            hitbox.Transparency = 0.5
            hitbox.BrickColor = BrickColor.new("Really red")
            hitbox.CanCollide = false
            hitbox.CFrame = hrp.CFrame
            hitbox.Parent = workspace  -- altijd in Workspace voor physics stabiliteit

            -- WeldConstraint zodat hij meebeweegt
            local weld = Instance.new("WeldConstraint")
            weld.Part0 = hitbox
            weld.Part1 = hrp
            weld.Parent = hitbox
                
            game.Debris:AddItem(weld, 1)    
            game.Debris:AddItem(hitbox, 1)
            
            local WaterTornadoVFX = game.ReplicatedStorage.VFX.WaterTornadoVFX:Clone()


            local rootAttachment = hrp:FindFirstChild("RootAttachment")

            spawnVFX(game.ReplicatedStorage.VFX.WaterTornadoVFX, hrp.CFrame)
#

local hitboxcooldown = false
hitbox.Touched:Connect(function(hit)
if hit.Parent.Name ~= plr.Name and hit.Parent:FindFirstChild("Humanoid") then
if hitboxcooldown == true then return end
hitboxcooldown = true

                    hit.Parent:FindFirstChild("Humanoid"):TakeDamage(10)

                    if cooldown == true then return end
                    if lastcooldown == true then return end

                    spawn(function()
                        cooldown = true
                        cooldown = false
                    end)


                    local BV = Instance.new("BodyVelocity")
                    BV.MaxForce, BV.Velocity = Vector3.new(5e4, 5e2, 5e4), plr.Character.HumanoidRootPart.CFrame.LookVector * 10
                    BV.Parent = hit.Parent.HumanoidRootPart
                    game.Debris:AddItem(BV, 0.16)

                    local bool = Instance.new("BoolValue") -- dit geeft een boolvalue aan de enemy, die stun heet
                    bool.Name = "Stunned"
                    bool.Parent = hit.Parent
                    game.Debris:AddItem(bool,1)

                    task.wait(1) -- !nog wellicht veranderen
                    hitboxcooldown = false
                    wait(5)
                    if hitbox then
                        hitbox:Destroy()
                    end
                end
            end)
        end
    end)
shadow wingBOT
#

studio** You are now Level 9! **studio

burnt sedge
#

it glitching so weird

ebon hinge
#

ooh wait

#

this might be the BV

burnt sedge
#

so everytime when i the bubbles pop, that is when i press 3 again

burnt sedge
#

you are cooking

#

i think i know what it is

cosmic jacinth
#

plr.Character.Humanoid.WalkSpeed = 16
task.wait(0.1)
plr.Character.Humanoid.WalkSpeed = 16
change this

ebon hinge
#

...you made the duration of the BV too short

#

0.16 secs?

burnt sedge
#

nah look

ebon hinge
#

for the duration of the entire ability?

burnt sedge
#

like the code

ebon hinge
#

serious?

burnt sedge
#

wait

#

so when i do a attack

cosmic jacinth
#

spawn(function()
local humanoid = plr.Character:FindFirstChild("Humanoid")
if humanoid then
local originalCFrame = plr.Character.HumanoidRootPart.CFrame
humanoid.WalkSpeed = 16
task.wait(0.1)
humanoid.WalkSpeed = 16

    plr.Character.HumanoidRootPart.CFrame = originalCFrame
end

end)

burnt sedge
#

it makes my body push a little a head

ebon hinge
#

right

burnt sedge
#

and i think it is the bv

#

that i coded

#

local BV = Instance.new("BodyVelocity")
BV.MaxForce, BV.Velocity = Vector3.new(5e4, 5e2, 5e4), plr.Character.HumanoidRootPart.CFrame.LookVector * 10
BV.Parent = hit.Parent.HumanoidRootPart
game.Debris:AddItem(BV, 0.16)

#

this

#

so i should

#

delete it?

ebon hinge
#

" plr.Character.HumanoidRootPart.CFrame = originalCFrame"

#

thats what

cosmic jacinth
#

YEAH

ebon hinge
#

delete that one line instead

cosmic jacinth
#

thats problem

cosmic jacinth
#

problem

#

btw

burnt sedge
ebon hinge
#

" plr.Character.HumanoidRootPart.CFrame = originalCFrame"

#

this

cosmic jacinth
#

local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(5e4, 5e2, 5e4)
BV.Velocity = (hit.Parent.HumanoidRootPart.Position - hrp.Position).Unit * 10
BV.Parent = hit.Parent.HumanoidRootPart
game.Debris:AddItem(BV, 0.16)

ebon hinge
#

no??

#

you gotta keep that if you want to five the plr momentum

burnt sedge
#

bro

#

plr.Character.HumanoidRootPart.CFrame = originalCFrame

#

where did you find this

ebon hinge
#

in

spawn(function()
local humanoid = plr.Character:FindFirstChild("Humanoid")
if humanoid then
local originalCFrame = plr.Character.HumanoidRootPart.CFrame
humanoid.WalkSpeed = 16
task.wait(0.1)
humanoid.WalkSpeed = 16

    plr.Character.HumanoidRootPart.CFrame = originalCFrame
end

end)

burnt sedge
ebon hinge
#

...oh

burnt sedge
#

its from shadow

ebon hinge
#

aw fuck

#

thought i was cooking there

burnt sedge
#

haha lol

#

yeah i thought

#

like when i hit the character

cosmic jacinth
#

we arent know where your scripts etc

shadow wingBOT
#

studio** You are now Level 2! **studio

burnt sedge
#

it brings me a little forward

cosmic jacinth
#

so we cant do too much thing

burnt sedge
#

but that is only when hitting

cosmic jacinth
#

send all files where

ebon hinge
#

okay this is definitely the BV

cosmic jacinth
#

local BV = Instance.new("BodyVelocity")
BV.MaxForce = Vector3.new(5e4, 5e2, 5e4)
BV.Velocity = (hit.Parent.HumanoidRootPart.Position - hrp.Position).Unit * 10
BV.Parent = hit.Parent.HumanoidRootPart
game.Debris:AddItem(BV, 0.16) can you try this

burnt sedge
#

btw i also got this:

UIS.InputBegan:Connect(function(I,E) -- checkt of je niet aan het typen bent in de chat
if I.KeyCode == Enum.KeyCode.Three then -- nu gaat er iets gebeuren als je muis 1 clikt
if E then return end
if character:FindFirstChild("Stunned") then return end
if special2cooldown == false then

        game.ReplicatedStorage.MainEvent:FireServer("three")
        
        wait(0.1)
        Tornado:play()


        wait(0.65)

        special2cooldown = true
        wait(1)
        special2cooldown = false

    end
end

end)

#

this is the local one

ebon hinge
#

ooh thats

#

the BV of the guy who got hit

#

WAIT

#

i think i get it

#

Because the player is inside his own hitbox, it is affected by the BV that is intended to be the knockback

#

So basically you have to make it so that the hitbox filters the plr's charachter

#

you'd just have to make sure that the hit.HumanoidRootPart is not the same as hrp

#

oh its midnight now

#

damn

burnt sedge
#

yeah i know

burnt sedge
#

i think the problem is

#

that i weld it

ebon hinge
#

oh

#

uhh

#

where?

#

in the code?

burnt sedge
#

local hitbox = Instance.new("Part")
hitbox.Anchored = false
hitbox.Size = Vector3.new(5, 10, 5)
hitbox.Transparency = 0.5
hitbox.BrickColor = BrickColor.new("Really red")
hitbox.CanCollide = false
hitbox.CFrame = hrp.RootAttachment.WorldCFrame
hitbox.Parent = workspace -- altijd in Workspace voor physics stabiliteit

            -- WeldConstraint zodat hij meebeweegt
            local weld = Instance.new("WeldConstraint")
            weld.Part0 = hitbox
            weld.Part1 = hrp
            weld.Parent = hitbox

yeah look

ebon hinge
#

no i mean where do you check the hrp thing

#

that i have just explained

burnt sedge
#

local hitboxcooldown = false
hitbox.Touched:Connect(function(hit)
if hit.Parent ~= plr.Character and hit.Parent:FindFirstChild("Humanoid") then

#

so it checks

#

if hit parent

#

is not the player character

#

that activited it

#

btw it is the wels

#

weld

ebon hinge
#

how come would it be the weld?

burnt sedge
#

and now it acts normally

#

but i want it to weld

#

so maybe

#

i should just create the hitbox

#

and clone it

#

with the weld

ebon hinge
#

that would be kind of inconvenient

burnt sedge
#

i know

ebon hinge
#

how about this

burnt sedge
#

it should just work

ebon hinge
#

It SHOULD work

burnt sedge
#

bro

#

how do you even script that

#

haha