#My hitbox wont properly work
1 messages · Page 1 of 1 (latest)
send script
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
.
hmmmm I don’t see anything wrong can u send a vid? Sorry for the inconvenience
sure
not really a inconvenince
Use cframe instead of position
Try using cframe and without lookvector
u would only need that for rotation (orientation)in that example
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?
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
uh
** You are now Level 3! **
so hitbox.CFrame = humanoidrootpart.CFrame * 5try this
my brain
where
hitbox.Position = humanoidRootPart.CFrame + humanoidRootPart.CFrame * 5
on this part?
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
hitbox.CFrame = humanoidrootpart.CFrame * CFrame.new(xval, yval, zval)
is this on another line?
Replace the position line with that
and the values are ur distance from the humanoid root part
whatever u want it to be
?
where capital R
I see the problem
The distance from the humanoidrootpart
read ur variables
You're trying to set a vector3 value to a cframe value, causing the script to error
what do i do
😭
just change ```lua
hitbox.Position = humanoidRootPart.Position + humanoidRootPart.CFrame.LookVector * 5
to
```lua
hitbox.CFrame= humanoidRootPart.CFrame + humanoidRootPart.CFrame.LookVector * 5
he’s just gonna copy the code and not remember what to do
I’m tryna tell him step by step ig
There was only one step 😔
well true
uh it didnt work
this didnt work either
😭
ykw instead of showing step by step just copy this
😭
so hitbox.CFrame = humanoidrootpart.CFrame * CFrame.new(0, 0, -5) — -5 is the distance from the humanoid root part
where do i put that
replace the old CFrame script with that
if this doesnt work kruz im kissing you bro
game.Players.LocalPlayer in the server script right on the top 💀
what do i do then bro
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?
script prob wont run in rs or im wrong
why input ended and not input began?
it does run the hitbox just doesnt spawn infront of me
thats not the problem right onw since it works properly the problem is the hitbox 😭
true just saying bad code
anyways
not even sure how it works
it just does
but anyways
the player blah vlah
I'm not sure how it's spawning a hitbox in the first place considering it would be erroring out on the first line
how does that work bro
in the remote events add the player into one of the parameters
how do i accesss the player
The player that begins the input
😭 im doing sorcery
Especially considering the one guy is right, the script won't run in replicated storage
also input ended only detects ur input after u stop holding
u can just hold and never attack
so make it inputbegan
Where tf are you getting the hitbox 😭
but tje problem is the hitbox 😭
yeah but HOW is it not erroring
i legit made other hitbox scripts from other people hitbox script and its the same thing
** You are now Level 4! **
Because it's not running lol
I DONT KNOW
I LEGIT DONT EVEN KNOW WHY IT WONT WORK
even wit hother peoples script it oegit just stays in the middle of the map 😭
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
Just to confirm, where exactly is the script being stored
ill show rq
Bro I think you should start from the basics instead of jumping to hitboxes
Btw what episode of the brawldev tutorial are you?
Copying random code isn’t gonna get you anywhere
uh what basics 😂
Bro's committing sorcery rn. Somehow spawning a hitbox when the script is in replicatedstorage and errors out on the first line lol
exactly i didnt copy any it was just mine thats why its glitched 😂
Functions, variables, tables, remote events, etc
access the remote event in this script
I see that 😭
The script is in replicated storage?
make a variable equal to the event
and get .onserverevent
Yeah, so I don't know where he's getting that hitbox lol
😎
i still ddint understand that
i might be ed but ykyk
what do you really know about scripting?
did you follow any tutorials
yeah
😎
because im cool like that
i asked ai
to check some stuff and it said it was fine
Well the hitbox only spawns once bc it isn’t connected to a function but it shouldn’t work either way
like 2 days ago
I think its position errors to default which is why it doesn’t spawn on ur character
but it spawns on the middle of the map instead?
Yeah. Between being in replicated storage and the errors at the start, it shouldn't even be reaching the instance.new even if it did run
Because the way ur accessing the character is just wrong
U need to send the player from the remote event
He made it in explorer. See he set size 4,4,4 but in image its bigger
Then get the character from the player
and that’s why everything errored
exactly bro i forgot to say that mb
Oml
Bro 😭 😭
i didnt change anything i only asked
Yeah, I give up on this
Nvm
I know something you need
Start actually learning how to script
watch brawldev
Hes good
medication yeah type sh 😎
for beginners
literally everything
what episode r u on bro…
😎
episodes?
I just peeped ur username 💔
** You are now Level 11! **
of the beginner or advanced scripting playlist
im on like the noob scripting playloist 😎
yes what episode
ur tryna do user input service and remote events when ur in the noob playlist
What makes you untrusted
stop rushing urself and doing complicated stuff
there isnt a noob playlist lol
i try to learn what im typing ass i do it ykyk
yeah we all start somewhere but
ur doing too complicated stuff
Look into this too: https://create.roblox.com/docs/scripting/events/remote
that isnt noob tho it says beginners
its in
same thing
noob vs pro vs hackers
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
oh yeah i made that once 😎
ngl
i made the hitbox on another game and it worked and it dealt dmg
but now idk why i cant
can’t u use workspace:GetPartsBoundInBox?
do it
** You are now Level 6! **
i can send vid
and then some other stuff
Yes but they also need to add a debiunce and sanity checks
touched events can’t detect multiple players
it can trust
well those things don’t count they are obvious
if you don’t add a cooldown and it just oneshots everyone then yes
Maybe for people who have experience with scripting
I’m assuming this is their first time making a full combat system
Not even an ig.People without experience just wouldn't know what sanity checking even is 😔
I saw this exact same system on a yt tutorial
sanity check isn’t that to check if it’s a plr humanoid it’s attacking
cant you scale the dmg? and also there is a cooldown
huh
isn’t that what a sanity check is
Not exactly
What is it then
Checks to prevent exploiting
oh
Yes detecting the humanoid is part of it though
just don’t make ur stuff on local scripts
A sanity check makes sure that information being sent from the client is accurate to what is happening in the server
That won’t make your game hacker proof
Roblox gives full character control to the client
So they can spoof positions, movement, etc
well
true
I don’t think this guy needs the sanity checks tho
cuz he doesn’t even know how to
Not now but definitely in the future
set variables right
Fair point but you see what I mean right
so... 😎
We’re saying start from the basics
the lesson of the day is: start actually learning what ur doing instead of making this…
watch brawldev
he’s peak
if you do watch him
watch him more
^^^^^
The documentation is VERY important
I almost never use it lol
and... 😎
I can tell
magic
Or you can follow another combat tutorial but it won’t help in the long run
cmon my scripting isn’t that bad…
too complicated for his skill level imo
u need modules and stuff
what if i learn the basics but i dont remember the basics?
Practice
Bro you literally copy down what they type
Literally this, it means ur not practicing enough
I thought u meant like learn from them
sorry
U can’t remember stuff you don’t use
no like i legit cant remember it for that long even with practice 😂
like what can’t u remember?
Ur good bro but real talk barely anyone actually tries to learn from them
Just experiment with the basics. You learn something new, try it out in studio. Learn its applications. Try out how it behaves with other things you've learned, etc
Yeah and try to learn things one at a time
yeah bro it’s always the guys that that say “omg guys just move [insert enshitiffication script] here and there!”
Too much can lead you to forget way easier
basics only ones i know are like functions prints variables and ykyk skibidi toilet
i do 👿
Right but you need to understand Roblox studio too
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
There's plenty more basics to learn than these—just keep expanding your knowledge base and focus on application as well as theory
okay
** You are now Level 5! **
yep btw you don’t just retain ur memories sometimes
There are days where u lock in so hard
It all just clicks
permanently
so just try ur best
aigh
Kk bye