#Should I handle hitboxes in Localscript or Serverscript?
1 messages · Page 1 of 1 (latest)
Server: hit detection
Client: effects
Both: use remote events or bindables forgot the difference ngl
@light condor
wAIT
So i handling animations in local, how would i fireserver to a serverscript that attaches a hitbox to the sword?
yk wut are remote events for right? (They are used to communicate from server to client and client to server)
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
why not
weld a hitbox to the sword
make the transparency 1 and literally detect hits like that
Ez way making a box and putting it to the sword with no collision :p
Use rig edit
👁️ 👄 👁️
@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
Uhm @tired nova
too late for me to use my pc rn you got this @tired nova you can help him
LOL
** You are now Level 1! **
is greatsword a part?
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)
ye mb
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
Dawg how u gonna ping me to check deleted code💔
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
what are u looking to do with this
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
u should use touched for ur first
Nah bc, u could js detect the hitbox being touched and damage the enemy there
gotta make the part a bit bigger than the blade
the hitbox is a whole box
but sometimes doesnt work
alr wait
ima get my past version of game back
@tired nova
join
Ragebait ts js ragebait huju stop talking huju 💔
you do NOT have to attach
just make the hitbox like 10 studs away from where the player is looking
and anchor it
@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
yes
yes
tysm
The hitbox should always be serverside
Never ever trust the client blindly