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

This Does not change the text of the TextLabel. Why?

Asked by 5 years ago

So this is a local script. I dont know if you can access the workspace via a local script. If you cant then do you have any idea on how i can?

-- Text Label -- 
local MainGui = script.Parent
local ScoreTeamOne = MainGui:FindFirstChild("TeamScoreOne").Score
local ScoreTeamTwo = MainGui:FindFirstChild("TeamScoreTwo").Score
local Quarter = MainGui:FindFirstChild("Quarter").TextLabel
local Minutes = MainGui:FindFirstChild("Minute").TextLabel
local Seconds = MainGui:FindFirstChild("Seconds").TextLabel
local ShotClock = MainGui:FindFirstChild("ShotClock").TextLabel
local TeamOne = MainGui:FindFirstChild("NameOne").HomeName
local TeamTwo = MainGui:FindFirstChild("NameTwo").AwayName
-- Values --
local ScoreboardValues = workspace:FindFirstChild("ScoreboardValues")
local HomeScore = ScoreboardValues:FindFirstChild("HomeScore")
local AwayScore = ScoreboardValues:FindFirstChild("AwayScore")
local SecondsValue = ScoreboardValues:FindFirstChild("Seconds")
local MinutesValue = ScoreboardValues:FindFirstChild("Minutes")
local ShotClockValue = ScoreboardValues:FindFirstChild("ShotClock")
local QuarterValue = ScoreboardValues:FindFirstChild("Quarter")

-- Text Label Values -- 
ScoreTeamOne.Text = HomeScore.Value
ScoreTeamTwo.Text = AwayScore.Value
Quarter.Text = QuarterValue.Value
Minutes.Text = MinutesValue.Value
Seconds.Text = SecondsValue.Value
ShotClock.Text = ShotClockValue.Value
0
You can't acess workspace through a local script, but is this a GUI located in the PlayerGui folder or is it a local script inside of workspace? ShootingLeo 35 — 5y
0
its a local script inside a ScreenGUi WillBe_Stoped 71 — 5y
1
`You can't acess workspace through a local script` completely false; it's just that whatever changes you make wont replicate to the server. Even then, how're we able to get the player's camera via the Workspace? `Workspace.CurrentCamera` TheeDeathCaster 2368 — 5y
0
oof so got any idea how to change the text? lol xd WillBe_Stoped 71 — 5y
View all comments (3 more)
1
I think your script only changes the value once only in the game, when the script is first run. Also, if you use FindFirstChild it will have the possibility to return nil if the object has not loaded yet when the script is run, so I recommend WaitForChild() instead. So, you might want to set up a .Changed event that updates the GUI everytime the values in the workspace changes. Rheines 661 — 5y
0
ok WillBe_Stoped 71 — 5y
0
using findfirstchild like that is completely pointless Gey4Jesus69 2705 — 5y

Answer this question