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

How can I use a remote event to set up a timer/intermission GUI?

Asked by 4 years ago

Im making a game with an intermission timer set and it transitions into a Map voting to essentially loading the character in the game. I know I need to make a remote event for the timer/seconds but have no clue on how to do so. This is my Local Script which has a "while true do" statement (for the timer) within it that I know I need to move.

local seconds = game.ReplicatedStorage.Time
local Nextt =  game.Workspace.Next
local Status = game.ReplicatedStorage.Status
while true do
    wait(1)
    seconds.Value = seconds.Value - 1
local Game = game.Workspace.Game.Position
    if seconds.Value == 0 and Nextt.Value == 0 then --When Intermission is over
        Nextt.Value = 1
        seconds.Value = 15
        Status.Value = "Map Voting -  "
        script.Parent.Parent.Parent.Intermission.TextLabel.Position = UDim2.new(0.511, 0,0.026, 0)
        script.Parent.Parent.Parent.Intermission.TopBar.Visible = true
        script.Parent.Parent.Parent.Vote.ImageButton.Visible = true
        script.Parent.Parent.Parent.Vote.Forest.Visible = true
        script.Parent.Parent.Parent.Vote.Votes.Visible = true
    end
if seconds.Value == 0 and  Nextt.Value == 1 then--When Map Vote is over
    Nextt.Value =  2
    seconds.Value = 3
    Status.Value = "The Forest has been selected!"
    script.Parent.Parent.Parent.Intermission.TextLabel.Visible = false
    script.Parent.Parent.Parent.Vote.ImageButton.Visible = false
    script.Parent.Parent.Parent.Vote.Forest.Visible = false
    script.Parent.Parent.Parent.Vote.Votes.Visible = false
end
if seconds.Value == 0 and Nextt.Value == 2 then
    Nextt.Value = 3
    seconds.Value = 5
    Status.Value = "Player has been selected to be the Seeker"
    end
if seconds.Value == 0 and Nextt.Value == 3 then
    Nextt.Value = 4
    seconds.Value = 5
    script.Parent.Parent.Parent.Intermission.TextLabel.Position = UDim2.new(0.511, 0,0.026, 0)
    Status.Value = "Game starts in    "
    script.Parent.Parent.Parent.Intermission.TextLabel.Visible =  true
end
end

Can someone explain this for me please? Thanks!

0
A recommendation, don't use LocalScripts to change game values. It won't go across the server to other clients, use a ServerScript instead. If you need help on how RemoteEvents work, I posted an answer on someone's question explaining the basics on them. https://scriptinghelpers.org/questions/94651/can-someone-help-me-understand-remote-events-they-dont-work-for-me#87427 killerbrenden 1537 — 4y

1 answer

Log in to vote
0
Answered by
shackfu 14
4 years ago

https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

this article is great for understanding remote events. Just scroll down to the "server to all clients" part.

You'll want to put most of this into a server script, and whenever you need to do something related to the GUI, you'll want to make a new remote event for that (although of course you want to use the least amount of remote events you can). Also, I'm going to assume that ReplicatedStorage.Status is an object value you created - good on that, you can use that in your remote events.

Ad

Answer this question