TextLabel.Text won't change. Almost considering this a Engine Bug

Know this post here?

Still ins’t working and i made some changes in the script .

This is probally gonna sound Unusual or maybe dumb. But mine TextLabel is not wanting to change trought script.

  1. Well I really tryed of everything, checking if the code’s running with print or even changing it to Other places and redoing it to find the odd’s.

Mine script is about when a player clicks a button displaying a car, (Using Viewportframe) it goes to a global Gui where it will display the Car Values in certain gui’s. ( The car values are a table with Subtables inside made in a module script) This is rather to find efficiency and probally make less lag that if i was making for each Buttons a gui, and I’m now on the part where i globally show all the values but now Im checking if the table can be portable in the text.

I just want to know why it inst working :pensive:

  1. Well I kinda don’t see where the problem is because… It’s really unknow for me as an Early scripter.

Here’s some photo to maybe clarify it:

2020-12-31 (3)_LI

And here’s the script with the Code. I just want to know why it inst working

-- Services

local TweenService = game:GetService("TweenService")
local Players = game:GetService("Players")
local localplayer = Players.LocalPlayer
local Servertorage = game:GetService("ServerStorage")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local CoreGui = game:GetService("CoreGui")
local StarterGui = game:GetService("StarterGui")

-- Main Variables

local GameImage = StarterGui:WaitForChild("ScreenGui"):WaitForChild("GameImage")
local Store = GameImage:WaitForChild("StoreBttn")
local AppearStore = GameImage:WaitForChild("StoreAppear")
local CmDlPr = AppearStore:WaitForChild("CMdlPr")
local InRes = ReplicatedStorage:WaitForChild("WhatinThe")
local Databs = require(game:GetService("ReplicatedStorage").TableOfValues)

-- Inside Variables

local PreviewCar = CmDlPr:WaitForChild("GlobalCarPreview")
local Buy = CmDlPr:WaitForChild("BuyBttn")
local Carname = CmDlPr:WaitForChild("CarName")
local Carprice = CmDlPr:WaitForChild("CarPrice")

-- Functions

local function InResponseD()
	local copy = {"woo", "rice","neat"}
	for i, v in pairs(copy) do
		if copy then
			Carname.Text = copy[2]
			Carprice.Text = copy[3]
		end
	end
end


InResponseD()
  1. I tryed using the print function, looking into Roblox Developer Api Reference and Roblox Forum (Here), youtube tutorials but Now that im able to post, here it goes.

You’re changing the gui in StarterGui, instead of the player’s PlayerGui. Anything changed in StarterGui won’t change onscreen, and will instead only change the next time the player resets (granted the GUI refreshes). This should be as simple as changing local StarterGui = game:GetService("StarterGui") to local StarterGui = localPlayer.PlayerGui (you might want to change the variable name though)

3 Likes

Thank you fellow Roblox Developer! Here some cookies :cookie: :cookie:

3 Likes

Based on the code I see right now, there are few problems I see immediately:


ModuleScripts are scripts that are meant to store functions that can be used, and I can tell that you don’t know how to write a ModuleScript. ModuleScripts can’t execute the code you have written in it. Please refer to the ModuleScript page and learn tutorials online regarding ModuleScripts so you know how to properly write and use them.


The script you really need is a LocalScript located in the button, where it fires a RemoteEvent when the button gets clicked (which can be detected using a Mouse1ButtonClick Event). The RemoteEvent allows a LocalScript (client-sided) to call a Script (server-sided) to execute code that would effect everyone rather than just the player. I recommend looking through the TextButton page carefully and learn more about RemoteEvents and how you can use them. Here is a sample of code that fires a RemoteEvent when a user clicks on a TextButton (modify to fit your needs):

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local button = script.Parent

-- Change the "RemoteEvent" to the name of the RemoteEvent you are using.
-- Make sure that the RemoteEvent is located in ReplicatedStorage
local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

-- This button will try to find a (server) Script that will listen for the event
-- fire so that the button can do server-sided stuff.
function onClick()
   -- This is just a variable that will be carried over to the (server) Script
    local number = 5

    -- You can have any kind (or number) of Parameters for FireServer 
    -- (or any of the EventFire functions) as long as the script listening for 
    -- the EventFire has the same parameters
    remoteEvent:FireServer(number)
end

-- Don't forget this line. It allows the function to execute when the button is clicked
button.MouseButton1Click:connect(onClick)

You will also need to create a regular script (not a LocalScript) that will be triggered when the RemoteEvent is fired, which, in this case, will use the event OnServerFire (which will require an addition argument player as the first argument, followed by all of the parameters you have sent through the FireServer function). I recommend looking through the RemoteEvent page to better understand how to use RemoteEvents.


That’s all I can really say right now, but this should hopefully help you go in the right direction in solving the issue you are having.

2 Likes

Thank you!

I know all of those things but din’t know i should use some of them that way!

And you’re right I was actually right now watching a AlvinBlox video about module script and seeing Community Tutorials about it, also Thank you so much for that! It will give me alot of time to i get working on another things for Mine Test game(Mine experience simulator lol)! Wish you a New Year :grin:

About the Button, all of their functions (MouseButton1Click) are located in a only Localscript so I can make it more efficient and all of their functions are these:

Button.MouseButton1Click:Connect(function()

It helps me save alot of time but ima change the function to be local since there are too many.

Again thank you so much! Here some cookies too :cookie: :cookie:

1 Like