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

Why is the text label not showing?

Asked by 3 years ago
Edited 3 years ago

Hello, as you may see from the code listed below, I am making a Roblox "squid game" I wouldn't call myself the most experienced at Lua, though I am learning.

The problem is, I have a "module script" inside replicated storage with a function being called, this function is called "DollFunction()" calling this function which I have done and works fine, will cause the Doll to come "alive", e.g sound effects and so forth. The problem is I have a text label in a 'screen gui' that says the phrase "Red light" or "green light". -Default set to "green light". However, that can be easily changed using "text =" etc. Anyways the problem is, this text GUI will not show even though it is being called to, and sometimes breaks the actual doll module script. So I have it set to "if doll spin is playing then..." so when the Doll Spin sound is played from the Module script when the doll function is called, the GUI will appear, however that is not the case.

My code for the TextLabel, this is in the 'StarterGui, RedLightGreenLight, GameText, Script'

script.Parent.Visible = false -- Setting value to false

if game.Workspace.DOLL_SPIN.IsPlaying then  -- Checking if the sound is playing
    script.Parent.Visible = true  -- Setting value to true to make the gui appear
    script.Parent.Text = "Red Light"
    wait(1)
    script.Parent.Visible = false  -- Setting back to false
else 
    script.Parent.Text = "Green Light"
end

Now moving on to the Module Script, this is located in replicated storage.

local PlayerFinish = true
local DollFolder = game.Workspace["Red light, Green light"].Doll
local DollSound = game.Workspace["Red light, Green light"].Sound_Doll
local DollTurn = DollSound.DOLL_SPIN
local DollAmbient = DollSound.DOLL_AMBIENT
local PlayerFinish = true
local DollTurn = game.Workspace["Red light, Green light"].Sound_Doll.DOLL_SPIN
local module = {}

local function DollFunction()
    repeat
        wait(5)
        wait(math.random(3,8)) 
        DollTurn:Play() 
        print("Doll Rotated")
        wait(4) 
        print("Doll back to normal position")
        wait(math.random(5,8)) 
        DollTurn:Play() 
        print("Doll Rotated")
        wait(4)
        print("Doll back to normal position")
    until PlayerFinish == false 
end 


return DollFunction

The Function is called in a separate script, though there is no problem with that. Any help and an explanation why what is happening would be great.

0
1. why did you define dollturn and playerfinish twice on the second script User#30567 0 — 3y
0
2. why are you controlling the startergui with a script? you're supposed to control it with a localscript User#30567 0 — 3y
0
3. my understanding is that the first script only runs once. if so, a good idea is the wrap it in a loop User#30567 0 — 3y
0
3. (cont.) even better, wrap it in a DollTurn.Changed function so you don't have to keep looping User#30567 0 — 3y
0
dm me on discord (Loma#8374) if you have any problems. i don't check sh so you'll get better help from me there User#30567 0 — 3y

Answer this question