#Damage dealt 8 times instead of 1

1 messages · Page 1 of 1 (latest)

timber crown
#

I want to do something simple, make an explosion that deals 40 damage. But my function is repeating 8 times(Dealing 8*40 dmg), even when I tried to do system to make it hit only once with if alreadyHit then return end

#

it prints out

#

no ai could help me, all tried with some debouncing, which didnt worked

wild lion
#

or instead you can use explosion.Hit:Once() instead of explosion.Hit:Connect()

#

theres already a post similar to this thats solved

timber crown
#

now it prints out 4 times

#

which means player is taking 160 dmg instead of 40

grave wedge
full inletBOT
#

studio** You are now Level 10! **studio

grave wedge
#

if it hits something that isn't player it will not work

#

just use connect and optionally disconnect it once it hits something

timber crown
full inletBOT
#

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

grave wedge
#

okay

#

this is good for third day of studio

tranquil parcel
#

Once only runs once so if 1 plr gets hit no other ones will get

timber crown
#

thanks. one more question is it okay, that I am using
create:FireAllClients(plr, mousepos)
which creates projectile for every client
and then on the server side it creates an explosion(because when explosion was for every client players were turning invisible and their bodies were levitating in the air)?

#

I hope yall understand what I mean

tranquil parcel
#

I think that's fine

#

But make sure u don't fire it every frame or smth

timber crown
#

now I am trying to figure out, why this
projectile.Touched:Connect(function(part)
if part.Parent ~= char and part.CanCollide == true then
game.ReplicatedStorage.Remote.Wybuch:FireServer(projectile.Position)
projectile:Destroy()
connection:Disconnect()
end
end)
is happening 4 or 8 times

#

because this function is telling server to create an explosion

timber crown
#

nahh, I cant with this

#

why "Z" is being printed two times when I press Z, X, C or F(instead of one time)

#

and also this

timber crown
#

bro

#

why 1 click = 2 prints

grave zephyr
#

@timber crown what im guessing is you’re cloning the explosion script multiple times

grave zephyr
timber crown
grave zephyr
#

So the only possible problem is cloning

grave zephyr
grave zephyr
#

Let me try something

timber crown
#

I clicked D => A => Z => Z

#

everything is doubled

grave zephyr
#

so when you click a key, it prints twice

timber crown
#

yeah

full inletBOT
#

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

grave zephyr
#

for me it only prints once. i only have 1 input began connection setup

#

if i add two of them though, it prints twice

#

so see if you're creating any extra input began connections anywhere

timber crown
#

thats why im so frustrated

#

I dont have anywhere else UIS

#

and also

#

we can see where on what line is prints or smth

grave zephyr
#

mhm yup

timber crown
grave zephyr
#

go to line 73

#

hmmm

timber crown
#

yeah...

grave zephyr
#

LocalBomb

timber crown
grave zephyr
#

check to see if maybe there's an extra bomb somewhere that's being created that you don't know about

#

an extra tool that's being ran

timber crown
#

I tripled check everything

#

I have like 8 scripts max

#

and remembered

#

that I was using script to constantly spawn a new bomb

timber crown
#

uncommented

grave zephyr
#

haha

#

well there's ur problem

#

the body of spawnNewBomb was being called, causing an extra bomb to be spawned

timber crown
#

but like

#

I only spawn one bomb

rough ridge
#

Make damage = 10

#

And don’t need to fix problem

timber crown
#

I mean true

#

but yk

#

I want to understand why is it happening

#

and learn smth

rough ridge
#

Did u try it with once

#

But that wouldn’t work cause it will never happen again

timber crown
#

or sometimes after some changes or before some changes it was 8

rough ridge
#

Shi just make your life easy

timber crown
grave zephyr
timber crown
#

and I just clone it and put in workspace

#

yeah

#

and thats the only bomb

grave zephyr
#

oh

#

ohhhh

#

hm

timber crown
#

but still Ill just move from replicated storage to workspace that template and comment this whole script

#

yeah, Idk, for now Ill just make dmg/4

#

if anyone knows what the cause might be, please say here and ping me