So basically what I am trying to do is create a remote event that would immediately trigger a white screen but, it doesn’t work. This is the server script:
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
if game.Workspace.Game.Variables.Explosion.Value == true then
game.ReplicatedStorage.ImmediateExplosionScreen:FireClient(player)
end
end)
end)
The explosion value gets changed on true but when it is true it doesn’t work either way…
and this is the client one:
This is in a LocalScript in a GUI? Do GUIs reset on death? If so, it’s likely that your event is firing before the GUI loads. This is only a problem because the event only fires when the character respawns. Is that intentional? If it’s not intentional and you want the event to be fired whenever Explosion.Value is changed, do this.
game.Workspace.Game.Variables.Explosion.Changed:Connect(function(value)
if value then
game.ReplicatedStorage.ImmediateExplosionScreen:FireAllClients()
end
end)
If you do indeed only want the event to fire when the player respawns, you’ll need to wait a few seconds before firing it, or better yet get rid of the server script altogether and do this in the LocalScript:
if game.Workspace.Game.Variables.Explosion.Value then
script.Parent.BackgroundTransparency = 0
end
Or, if GUIs don’t reset on death and you only want the event to be fired upon respawning, let me know and we’ll keep working it out.
print("Runs on respawn")
print("Explosion.Value is", workspace.Game.Variables.Explosion.Value)
if game.Workspace.Game.Variables.Explosion.Value then
print("Setting transparency")
script.Parent.BackgroundTransparency = 0
end
game.Players.LocalPlayer.CharacterAdded(function()
if game.Workspace.Game.Variables.Explosion.Value then
print("Setting transparency")
script.Parent.BackgroundTransparency = 0
end
end)