Hello, developers! ![]()
I have been making a game about throwing boxes into people, however, recently I’ve been making a flash bang perk that blinds people around the box with an explosion using an RemoteEvent. ![]()
![]()
Though after testing I found out that, if you die, the remote event stops working, i have gotten NO errors, NOTHING, the remote event stops printing completely, while the script that sends the remote event seems to work fine. ![]()
![]()
I cannot find people talking about this, so I’ve come here for help! ![]()
Script that sends remote event:
if plrHRP.particleAttach.flash_symbol.Enabled == true then
local exp_flash = Instance.new("Explosion")
exp_flash.Visible = false
exp_flash.Parent = workspace
exp_flash.Position = Obj.Position
exp_flash.BlastPressure = 0
exp_flash.BlastRadius = 10
Obj.Particles.flash_fx:Emit(1)
Obj.flash_sfx:Play()
exp_flash.Hit:Connect(function(hit)
local flash_dbc = false
if flash_dbc == false then
flash_dbc = true
local playerService = game:GetService("Players")
if hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
exp_flash:Destroy()
local playerFromCharacter = playerService:GetPlayerFromCharacter(hit.Parent)
print(playerFromCharacter)
hit.Parent.flash_perk.flash_hit:FireClient(playerFromCharacter)
print(hit.Parent.flash_perk.flash_hit:FireClient(playerFromCharacter))
end
task.wait(0.1)
flash_dbc = false
end
end)
Script that receives the remote event:
local plr = game.Players.LocalPlayer
local dbc = false
plr.Character.flash_perk.flash_hit.OnClientEvent:Connect(function()
print("flashy")
if dbc == false then
script.Parent.flash_hit_Sound:Play()
game.Lighting.flash_bang_fx.Enabled = true
game.Lighting.flash_bang_fx.Brightness = 1
dbc = true
for i = 0, 20 do
game.Lighting.flash_bang_fx.Brightness -= 0.05
task.wait(0.1)
end
game.Lighting.flash_bang_fx.Enabled = false
end
task.wait(0.5)
dbc = false
end)
I know my script is trash, I’m kinda bad ngl. ![]()