#Should I handle hitboxes in Localscript or Serverscript?

1 messages · Page 1 of 1 (latest)

wanton moon
#

Currently I am making a hitbox on client and fires the hit to server.

light condor
#

Server: hit detection
Client: effects

Both: use remote events or bindables forgot the difference ngl

wanton moon
#

@light condor

#

wAIT

#

So i handling animations in local, how would i fireserver to a serverscript that attaches a hitbox to the sword?

light condor
#

🫩 yk wut are remote events for right? (They are used to communicate from server to client and client to server)

wanton moon
#

ye

#

but how do i comminucate a constantly moving sword

#

I want a hitbox attached to the player's sword

#

what is the directory for that

#

Wait are you sure I shouldn't detect hitss on client?

#

@light condor

tired nova
#

weld a hitbox to the sword

#

make the transparency 1 and literally detect hits like that

light condor
#

Ez way making a box and putting it to the sword with no collision :p

light condor
#

Use rig edit

light condor
wanton moon
#

@light condor So should i handle the hitbox on local or serverscript?

#

my server script:

#

local greatEvent = game.ReplicatedStorage.greatEvent
local meatEvent = game.ReplicatedStorage.meatEvent
local swordEvent = game.ReplicatedStorage.swordEvent
local db = true
local debounceTime = 0.29

--greatsword
greatEvent.OnServerEvent:Connect(function(plr)
local hitbox = game.ReplicatedStorage.Hitbox:Clone()
hitbox.Parent = workspace

if plr.Backpack:WaitForChild("Greatsword") then
hitbox.CFrame = plr.Backpack:WaitForChild("Greatsword")
end

end)

#

the hitbox part isnt spawning

light condor
#

Uhm @tired nova crying too late for me to use my pc rn you got this @tired nova you can help him

tired nova
#

LOL

sand steppeBOT
#

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

wanton moon
#

bro

#

yall

#

i atually need help pls

#

@tired nova

#

@light condor

wanton moon
#

greatsword is tool

#

wait

#

I deleted the code

#

here is my actual code rn

#

Btw

#

I used to use a touched event for my hitbox

#

but it didn't register some hits

#

so now Im making a new one

#

Heres my local:
local combo = 1
local db = true -- debounce variable
local debounceTime = 1.2 -- seconds

tool.Activated:Connect(function()
if not db then return end
db = false

delay(debounceTime, function()
    db = true
end)
if combo == 4 then
    
    m4:Play()
    wait(0.2)

    wait(0.5)
    combo = 1
elseif combo == 3 then
    
    m1:Play()
    wait(0.50)


    print("Third M1")
    wait(0.5)
    combo = combo + 1
elseif combo == 2 then
    
    m2:Play()
    wait(0.5)


    
    print("Second M1")
    combo = combo + 1
elseif combo == 1 then

    m3:Play()
    greatEvent:FireServer()
    wait(0.50)

    
    print("First M1")
    
    combo = combo + 1
end

end)

tired nova
#

u put

#

“hitbox.CFrame = plr.Backpack:WaitForChild("Greatsword")”

wanton moon
#

ye mb

tired nova
#

is greatsword some type of handle?

#

Yea

#

correct that

wanton moon
#

I deleted the script

#

This is mine now

#

heres the local:
local combo = 1
local db = true -- debounce variable
local debounceTime = 1.2 -- seconds

tool.Activated:Connect(function()
if not db then return end
db = false

delay(debounceTime, function()
    db = true
end)
if combo == 4 then
    
    m4:Play()
    wait(0.2)

    wait(0.5)
    combo = 1
elseif combo == 3 then
    
    m1:Play()
    wait(0.50)


    print("Third M1")
    wait(0.5)
    combo = combo + 1
elseif combo == 2 then
    
    m2:Play()
    wait(0.5)


    
    print("Second M1")
    combo = combo + 1
elseif combo == 1 then

    m3:Play()
    greatEvent:FireServer()
    wait(0.50)

    
    print("First M1")
    
    combo = combo + 1
end

end)

#

thats the local

tired nova
#

Dawg how u gonna ping me to check deleted code💔

wanton moon
#

It don't matter that much

#

mb

#

heres the serverscript

#

local greatEvent = game.ReplicatedStorage.greatEvent
local meatEvent = game.ReplicatedStorage.meatEvent
local swordEvent = game.ReplicatedStorage.swordEvent
local db = true
local debounceTime = 0.29

--greatsword
greatEvent.OnServerEvent:Connect(function(plr)
local hitbox = game.ReplicatedStorage.Hitbox:Clone()

end)

#

I don't know where to start

#

@tired nova

tired nova
#

what are u looking to do with this

wanton moon
#

I don't know how I would make a GetPartsInPart hitbox that is connected to the sword

#

alr

#

here

#

I got the onserverevent down

#

I want to attach a hitbox

#

to the "Blade"

#

in the tool

#

when a server event is called

#

but i don't know the directory or where to start right now

tired nova
#

u should use touched for ur first

wanton moon
#

really?
n

#

not getpartsinpart

#

caause i had a whole hitbox system before this

tired nova
#

Nah bc, u could js detect the hitbox being touched and damage the enemy there

wanton moon
#

thats what I did tho

#

but sometimes the hit didn't registert

#

and sometimes it did

tired nova
#

gotta make the part a bit bigger than the blade

wanton moon
#

the hitbox is a whole box

#

but sometimes doesnt work

#

alr wait

#

ima get my past version of game back

#

@tired nova

#

join

zinc talon
#

Quite the foolish question.

#

Lmfao.

oblique copper
#

Ragebait ts js ragebait huju stop talking huju 💔

raw plinth
#

just make the hitbox like 10 studs away from where the player is looking

#

and anchor it

wanton moon
#

@raw plinth

#

Is that how all games do it

#

beacuse i want a hitbox as accurate as possible

#

and i thought that making the hitbox on the blade would do it

wanton moon
#

Btw

#

Should i make the hitbox serverrside?

raw plinth
#

yes

wanton moon
#

tysm

rain wasp
#

Never ever trust the client blindly