Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I change the Visibility of something without resting characters?

Asked by
Ulysies 50
8 years ago

I should know this but I forgot how. I know that just changing the visibility does not work, because you have to reset the character. I think if you put it in a local script it would work? But I cant put it in a local script because I need it in a certain one.. Please help..

game.StarterGui.ScreenGui.Frame.Visible = true
wait(10)
game.StarterGui.ScreenGui.Frame.Visible = false
0
If you look at https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online it does this exact thing with remote events, which is probably the best way to do it. Perci1 4988 — 8y
0
i saw it thanks :) Ulysies 50 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

You changing the transparency of a Frame inside StarterGUi, which is loaded by a client each time the character respawns. To achieve what you are asking, you need to change PlayerGui, which is inside each player and stores everything that was cloned out of StarterGui when the character spawned.

You should do

player.PlayerGui.Frame.Visible = true
wait(5)
player.PlayerGui.Frame.Visible = false

If you dont have a certain player referenced, you can do a for loop to change all players.

for i,v in pairs(game.Players:GetChildren()) do
    coroutine.resume(coroutine.create(function()
        v.PlayerGui.Frame.Visible = teue
        wait(5)
        v.PlayerGui.Frame.Visible = false
    end))
end

I have used coroutine.resume(coroutine.create(function() here, because otherwise it would change one players gui visibility to visible, wait 5, make it invisible again, then move onto the next player. The coroutine allows the script to run to bits of code at the same time, and you an read up on them here http://wiki.roblox.com/index.php/Beginners_Guide_to_Coroutines

Ad

Answer this question