Right now I'm trying to make a blind script, reminiscent of a flashbang effect. It does this by firing the client which connects to a local script to trigger the blinding effect.
On the explosion script the script does not seem to fire the client, and there is no output error for this? What is wrong with it? (Its on line 12)
local proj = script.Parent
flashEvent = Instance.new("RemoteEvent")
flashEvent.Parent = game.ReplicatedStorage
flashEvent.Name = "FlashEvent"
function Explode()
for _,player in next,game.Players:GetPlayers() do
if player.Character then
local char = player.Character
if (char.Torso.Position - proj.Position).magnitude < 500 then
game.ReplicatedStorage.FlashEvent:FireClient(player)
end
end
end
end
function decimate()
local propellant = Instance.new("BodyVelocity")
propellant.Parent = proj
propellant.Velocity = Vector3.new(0,1000,0)
wait(1)
Explode()
local explosion = Instance.new("Explosion")
explosion.BlastRadius = 100
explosion.Parent = game.Workspace
explosion.Position = proj.Position
proj:Destroy()
end
decimate()
This is the code in the local script which waits until the explosion script (above) fires the client.
game.ReplicatedStorage.FlashEvent.OnClientEvent:Connect(function()
local bloom = Instance.new("BloomEffect",nil)
bloom.Intensity = 100
bloom.Parent = game.Workspace.CurrentCamera
for i = 1,bloom.Intensity do
bloom.Intensity = bloom.Intensity-1
wait(1/10)
end
end)
Thanks for any help!
