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

This GUI "Hint/Message" function does not fire?

Asked by 7 years ago

Hi, I am working on a GUI which displays a Message/Hint for a capture the point game I am working on. The Hint part works but the Message part does not work at all. The path of the StringValue is correct and the other script is working very well so I am not including the other script. I also checked the OutPut but OutPut shows no error.

The LocalScript below controls the display of the Hint/Message:

wait(0.1)
local winMSG = script.Parent.winMSG -- path is correct
local Hint = script.Parent.inProgress.titleTXT -- path is correct
local terminalScript = game.Workspace.RaidSystem.RaidSystemV1.Script -- path is correct
local whoCaptured = terminalScript.WhosControlling -- path is correct
local whoWon = terminalScript.WhoWon -- path is correct
local HintColor = terminalScript.HintColor -- path is correct
Hint.Visible = true

--[====================]--
--[     Hint Text Function      ]--
--[====================]--

while wait() do -- this hint command works correct so no problem here
    Hint.Text = whoCaptured.Value
end

--[==============]--
--[      Win Function ]--
--[==============]--

whoWon.Changed:connect(function()  -- this part DOES NOT work at all.
if whoWon.Value == "n" then -- the Value shows "n" but this 'if' command does not fire.
    winMSG.Visible = false
    winMSG.raidersBG.Visible = false
    winMSG.defendBG.Visible = false
    script.Parent.inProgress.Visible = true
elseif whoWon.Value == "r" then -- the Value shows "r" but this 'if' command does not fire.
    winMSG.Visible = true
    winMSG.raidersBG.Visible = true
    winMSG.defendBG.Visible = false
    script.Parent.inProgress.Visible = false
elseif whoWon.Value == "d" then -- the Value shows "d" but this 'if' command does not fire.
    winMSG.Visible = true
    winMSG.raidersBG.Visible = false
    winMSG.defendBG.Visible = true
    script.Parent.inProgress.Visible = false
end
end)

I explained half of the script in the LocalScript itself. I hope any one of you can help me with my problem and tell me what mistake I have done. Thank you for reading this and have a nice day.

0
Why not use a changed event instead of a while loop on line 14? User#5423 17 — 7y

1 answer

Log in to vote
0
Answered by 7 years ago

Try moving the while wait() do loop below your whoWon.Changed event. Your script is stuck in the loop. Also, I recommend you use an event to update the hint's text instead of the loop.

0
Thank you for helping me! :D PlayingOBC 70 — 7y
Ad

Answer this question