#My hitbox wont properly work

1 messages · Page 1 of 1 (latest)

open zealot
#

idk why my hitbox dont appear infront of me it appears in the middle of the map and i copied multiple codes but they dont work

open zealot
#

wait

#

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")

local hitbox = Instance.new("Part")
hitbox.Size = Vector3.new(4, 4, 4) -- Adjust as needed
hitbox.Anchored = true
hitbox.CanCollide = false
hitbox.Transparency = 0.5
hitbox.Color = Color3.new(1, 0, 0) -- Red so you can see it
hitbox.Position = humanoidRootPart.Position + humanoidRootPart.CFrame.LookVector * 5
hitbox.Parent = workspace

open zealot
modest dawn
#

hmmmm I don’t see anything wrong can u send a vid? Sorry for the inconvenience

open zealot
#

sure

modest dawn
#

Use cframe instead of position

open zealot
modest dawn
#

Try using cframe and without lookvector

#

u would only need that for rotation (orientation)in that example

open zealot
#

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")

local hitbox = Instance.new("Part")
hitbox.Size = Vector3.new(4, 4, 4)
hitbox.Anchored = true
hitbox.CanCollide = false
hitbox.Transparency = 0.5
hitbox.Color = Color3.new(1, 0, 0)
hitbox.Position = humanoidRootPart.CFrame + humanoidRootPart.CFrame * 5
hitbox.Parent = workspace

#

this?

#

like tis?

modest dawn
#

btw! You can do += instead of that long line and you can’t “add” c frames to actually add c frames u have to use the multiplication sign

open zealot
#

uh

rapid craterBOT
#

studio** You are now Level 3! **studio

modest dawn
#

so hitbox.CFrame = humanoidrootpart.CFrame * 5try this

open zealot
#

my brain

#

where

#

hitbox.Position = humanoidRootPart.CFrame + humanoidRootPart.CFrame * 5

#

on this part?

modest dawn
#

oop forgot something lemme fix it

#

you have to use CFrame.new

#

so hitbox.CFrame = humanoidrootpart.CFrame * CFrame.new(xval, yval, zval)

#

@open zealot

#

whatever position u want it to be in

#

if it doesn’t work tell me

open zealot
#

hitbox.CFrame = humanoidrootpart.CFrame * CFrame.new(xval, yval, zval)

is this on another line?

modest dawn
#

Replace the position line with that

#

and the values are ur distance from the humanoid root part

#

whatever u want it to be

open zealot
modest dawn
#

capital R

#

And the xval yval and zval are like a vector3

#

Just put the numbers

open zealot
#

where capital R

modest dawn
#

The distance from the humanoidrootpart

modest dawn
gilded topaz
open zealot
#

😭

#

my brain cant handle these

#

wait

modest dawn
#

bro

#

it’s supposed to be humanoidRootPart not humanoidrootpart

gilded topaz
#

just change ```lua
hitbox.Position = humanoidRootPart.Position + humanoidRootPart.CFrame.LookVector * 5

to
```lua
hitbox.CFrame= humanoidRootPart.CFrame + humanoidRootPart.CFrame.LookVector * 5
modest dawn
#

I’m tryna tell him step by step ig

gilded topaz
modest dawn
open zealot
modest dawn
#

did u change the CFrame.new() values?

modest dawn
#

ykw instead of showing step by step just copy this

open zealot
modest dawn
#

so hitbox.CFrame = humanoidrootpart.CFrame * CFrame.new(0, 0, -5) — -5 is the distance from the humanoid root part

open zealot
#

where do i put that

modest dawn
#

replace the old CFrame script with that

gilded topaz
#

OML

#

I figured out the problem lmao

open zealot
#

if this doesnt work kruz im kissing you bro

gilded topaz
#

game.Players.LocalPlayer in the server script right on the top 💀

open zealot
#

uh

#

i dont understand

#

😂

gilded topaz
#

You can't get the local player from a normal script lol

#

it'll just error

open zealot
#

what do i do then bro

modest dawn
#

Oh I didn’t notice the local player thing

#

access the player another way

#

Use remote events

#

fire server when player attacks

#

@open zealot are u using UIS?

open zealot
modest dawn
#

User input service

#

oh

open zealot
#

this script is the m1s

tacit pine
#

script prob wont run in rs or im wrong

modest dawn
#

why input ended and not input began?

open zealot
open zealot
modest dawn
#

anyways

#

not even sure how it works

open zealot
#

but anyways

#

the player blah vlah

gilded topaz
open zealot
#

how does that work bro

modest dawn
#

in the remote events add the player into one of the parameters

open zealot
#

how do i accesss the player

modest dawn
#

The player that begins the input

gilded topaz
modest dawn
#

also input ended only detects ur input after u stop holding

#

u can just hold and never attack

#

so make it inputbegan

gilded topaz
#

Where tf are you getting the hitbox 😭

open zealot
#

but tje problem is the hitbox 😭

modest dawn
open zealot
#

i legit made other hitbox scripts from other people hitbox script and its the same thing

rapid craterBOT
#

studio** You are now Level 4! **studio

gilded topaz
open zealot
#

I LEGIT DONT EVEN KNOW WHY IT WONT WORK

#

even wit hother peoples script it oegit just stays in the middle of the map 😭

modest dawn
#

calm down now

#

Let me
Explain

#

where is the remote event in ur script?

#

Like using it

#

@open zealot

#

Do you know how to use remote events

open zealot
#

uh

#

no

#

😂

gilded topaz
#

Just to confirm, where exactly is the script being stored

open zealot
normal grove
#

Bro I think you should start from the basics instead of jumping to hitboxes

modest dawn
normal grove
#

Copying random code isn’t gonna get you anywhere

open zealot
#

main event

#

is the remote vent

#

event

gilded topaz
open zealot
normal grove
modest dawn
modest dawn
open zealot
#

i didnt quite interpret that

open zealot
#

😎

modest dawn
#

and get .onserverevent

open zealot
gilded topaz
open zealot
#

😎

open zealot
#

i might be ed but ykyk

modest dawn
#

did you follow any tutorials

open zealot
#

yeah

#

😎

#

because im cool like that

#

i asked ai

#

to check some stuff and it said it was fine

normal grove
#

Well the hitbox only spawns once bc it isn’t connected to a function but it shouldn’t work either way

open zealot
#

like 2 days ago

normal grove
#

I think its position errors to default which is why it doesn’t spawn on ur character

open zealot
gilded topaz
normal grove
#

U need to send the player from the remote event

tacit pine
normal grove
#

Then get the character from the player

modest dawn
open zealot
gilded topaz
normal grove
#

Bro 😭 😭

open zealot
gilded topaz
#

Yeah, I give up on this

open zealot
#

so uh chat

#

whats wrong

#

😎

normal grove
#

Nvm

modest dawn
#

Start actually learning how to script

#

watch brawldev

#

Hes good

open zealot
modest dawn
#

for beginners

open zealot
#

he da goat

gilded topaz
modest dawn
open zealot
open zealot
normal grove
rapid craterBOT
#

studio** You are now Level 11! **studio

modest dawn
modest dawn
#

what’s wrong with my username

open zealot
modest dawn
modest dawn
normal grove
modest dawn
#

stop rushing urself and doing complicated stuff

open zealot
open zealot
#

im not

#

trust

open zealot
#

i try to learn what im typing ass i do it ykyk

modest dawn
#

Smartest individual

modest dawn
#

ur doing too complicated stuff

modest dawn
#

slow down

#

Start doing simple stuff

#

not whole attack systems

open zealot
open zealot
modest dawn
open zealot
#

the hitbox isnt tho

#

😎

open zealot
normal grove
#

Even after you make the hitbox part you realize ur gonna have to make the hit detection separately right

#

Unless you have a system for that you’re going to struggle with a damage handler

open zealot
#

ngl

#

i made the hitbox on another game and it worked and it dealt dmg

#

but now idk why i cant

modest dawn
open zealot
#

do it

rapid craterBOT
#

studio** You are now Level 6! **studio

open zealot
#

i can send vid

modest dawn
#

and then some other stuff

normal grove
modest dawn
open zealot
#

it can trust

modest dawn
modest dawn
normal grove
normal grove
#

I’m assuming this is their first time making a full combat system

gilded topaz
# modest dawn ig

Not even an ig.People without experience just wouldn't know what sanity checking even is 😔

modest dawn
modest dawn
open zealot
modest dawn
#

just for no errors

#

common sense

gilded topaz
#

huh

modest dawn
#

isn’t that what a sanity check is

modest dawn
normal grove
modest dawn
#

oh

normal grove
#

Yes detecting the humanoid is part of it though

modest dawn
#

just don’t make ur stuff on local scripts

gilded topaz
#

A sanity check makes sure that information being sent from the client is accurate to what is happening in the server

normal grove
#

Roblox gives full character control to the client

modest dawn
#

Exactly

normal grove
#

So they can spoof positions, movement, etc

modest dawn
#

true

#

I don’t think this guy needs the sanity checks tho

#

cuz he doesn’t even know how to

normal grove
#

Not now but definitely in the future

modest dawn
#

set variables right

normal grove
#

Fair point but you see what I mean right

open zealot
#

so... 😎

normal grove
#

We’re saying start from the basics

modest dawn
#

watch brawldev

#

he’s peak

#

if you do watch him

#

watch him more

normal grove
#

You can also look at Roblox docs or other scripts

#

See how things work

gilded topaz
modest dawn
open zealot
#

and... 😎

gilded topaz
modest dawn
#

lol

#

how so?

gilded topaz
normal grove
modest dawn
modest dawn
#

u need modules and stuff

open zealot
normal grove
normal grove
modest dawn
#

sorry

normal grove
#

U can’t remember stuff you don’t use

open zealot
modest dawn
normal grove
gilded topaz
normal grove
#

Yeah and try to learn things one at a time

modest dawn
normal grove
#

Too much can lead you to forget way easier

open zealot
#

basics only ones i know are like functions prints variables and ykyk skibidi toilet

normal grove
#

Like you gotta know why there’s a replicated storage, server storage, etc

#

You’re putting a server side (I assume it is) hitbox in rep storage

open zealot
#

i had this one

#

this was the one that worked

#

idk why it wont work now

gilded topaz
open zealot
#

okay

rapid craterBOT
#

studio** You are now Level 5! **studio

modest dawn
#

There are days where u lock in so hard

#

It all just clicks

#

permanently

#

so just try ur best

open zealot
#

aigh

modest dawn
#

Kk bye

warm wren
#

use a weld constraint

vague gazelle
#

@open zealot

#

are you serious

#

??

#

ur using fricking position

#

use hitbox.CFrame

#

and also

#

use modules

#

for hitboxes