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

Why is my Round System never working?

Asked by 9 years ago

I looked at so many tutorials but they only work for 'Printing' or 'Hint's'. Also, I tried to change the hint's to text, but it won't work.

I've tried many things to fix this problem but none of them are doing the trick, so I was wondering if someone could help. Thanks!

Errors: Text won't change. Map's won't load. It will not teleport you to the map.

Code:

001local playerNotifications = game.StarterGui.ScreenGui.Frame.TextLabel
002 
003function waitForPlayers()
004    if game.Players.NumPlayers < 1 then
005        playerNotifications.Text = "Waiting for players!"
006    end
007end
008 
009function intermissionTimer()
010    if game.Players.NumPlayers > 1 then
011        for countDown = 10, 1, -1 do
012        playerNotifications.Text = "Intermission: " ..countDown
013    end
014end
015 
View all 106 lines...
0
You have too many ends at the end. Move the end from 105 to line 12, since the script is thinking you're trying to end the function, not the loop all the way at line 11 M39a9am3R 3210 — 9y
0
You need 2 hyphens or it will error all the code below. https://gyazo.com/45afd362dc675514eccee844b46855b9 Azmidium 388 — 9y

1 answer

Log in to vote
0
Answered by 9 years ago

Problem #1: Notifications

StarterGui is basically where the guis get cloned from, it doesn't change everyone's guis. So, instead, you make a function, right at the start that you call whenever you want to change text:

01function notification(text)
02    for _,v in pairs (game.Players:GetChildren())
03        local find = v.PlayerGui:FindFirstChild("ScreenGui")
04        if find then
05            find.Frame.TextLabel.Text = text
06        end
07    end
08end
09 
10-- to call it: notification("your text here")

Problem #2: Map

It should work, I see no problems. It is most likely something before the map function has errored.

Problem #3: Teleporting

The problem is that MapChosen is a local inside the MapSelection function, which means it doesn't exist inside TeleportPlayers().

To fix this, I would recommend you just create a local right at the start of the script, on Line 2 or something, called "CurrentMap". When it chooses the map, it sets CurrentMap to MapChosen, so inside the MapSelection function:

1CurrentMap = MapChosen

This will mean you can get the current map in the entire script.

Also, here are some things to fix:

1. Make WaitForPlayers() a while loop, so:

1function WaitForPlayers()
2    while game.Players.NumPlayers < 2 do
3        notification("You need 1 more player to start the game.")
4    end
5end

2.IntermissionTime() needs an end under the for loop.

Hope I helped :)

Ad

Answer this question