title explains it, i’ve pretty much looked through every forum i could and couldn’t find anything
local function flashBang()
local function mainFlashBang(purpleFlashBang)
print("started flashbang function")
purpleFlashBang.Frame.Visible = true
for count = 1, 20 do
purpleFlashBang.Frame.BackgroundTransparency = purpleFlashBang.Frame.BackgroundTransparency - 0.05
wait(0.05)
end
purpleFlashBang.Frame.Visible = false
purpleFlashBang.Frame.BackgroundTransparency = 1
print("finished flashbang function")
end
for _, player2 in ipairs(Players:GetPlayers()) do
local playerGui = player2:FindFirstChild("PlayerGui")
if playerGui then
local purpleFlashBang = playerGui:FindFirstChild("PurpleFlashbang")
if purpleFlashBang and purpleFlashBang:FindFirstChild("Frame") then
coroutine.resume(coroutine.create(function()
mainFlashBang(purpleFlashBang)
end))
end
end
task.wait(0.015)
end
end
this is just a snippet, the problem here is that the gui is being created and enabled but disappears immediately without increasing the transparency
i’ve suspected that it’s the way that the purpleFlashBang variable is being casted, but i’ve tried to concatenate strings with each other for the variable names to no avail. any solutions?
sorry for the late reply, i’ve tried remote events as well (forgot to mention), but it seems to do nothing anymore. i’ll try to find the version of the scripts and i’ll come back
found it,
– server script
local replicatedStorage = game.ReplicatedStorage
local flashBangEvent = replicatedStorage:WaitForChild("flashBangEvent")
local function flashBang()
--[[local function mainFlashBang(purpleFlashBang)
print("started flashbang function")
purpleFlashBang.Frame.Visible = true
for count = 1, 20 do
purpleFlashBang.Frame.BackgroundTransparency = purpleFlashBang.Frame.BackgroundTransparency - 0.05
wait(0.05)
end
purpleFlashBang.Frame.Visible = false
purpleFlashBang.Frame.BackgroundTransparency = 1
print("finished flashbang function")
end]] -- don't use this function
for _, player2 in ipairs(Players:GetPlayers()) do
print("attempting to fire client")
flashBangEvent:FireClient(player2)
task.wait(0.015)
end
end
– client script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local flashBangEvent = ReplicatedStorage:WaitForChild("flashBangEvent")
local player2 = Players.LocalPlayer
local playerGui = player2:WaitForChild("PlayerGui")
local purpleFlashBang = playerGui:WaitForChild("PurpleFlashBang")
local function mainFlashBang()
print("started flashbang function")
purpleFlashBang.Frame.Visible = true
for count = 1, 20 do
purpleFlashBang.Frame.BackgroundTransparency = purpleFlashBang.Frame.BackgroundTransparency - 0.05
wait(0.05)
end
purpleFlashBang.Frame.Visible = false
purpleFlashBang.Frame.BackgroundTransparency = 1
print("finished flashbang function")
end
flashBangEvent.OnClientEvent:Connect(mainFlashBang)
remote events are put in the correct place along with names and capitalisation. the only thing that prints in the console is "attempting to fire client"
and not "started flashbang function" or "finished flashbang function". client script is a child of the Frame
okay, i was feeling a bit tired so i made some silly mistakes - i accidentally used the wrong capitalisation for the purpleFlashBang variable in the local script which made the function not work. i also used “- 0.05” instead of “+0.05” transparency which made it so that the gui had negative transparency, somehow. i tested this on a public server and gui is fading out nicely for everyone