My show status script is not working

Hello, I am struggling to make a script where the text label shows the value of a bool value in the text.
I have tried for a while and out lots of effort into trying to fix this but just can’t. Can someone help me?
Here is my code.

local replicatedStorage = game:GetService(“ReplicatedStorage”)

local Status = replicatedStorage:WaitForChild(“Status”)

local topStatus = script.Parent:WaitForChild(“TopStatus”)

topStatus.Text = Status.Value

Status:GetPropertyChangedSignal(“Value”):Connect(function()

topStatus.Text = Status.Value

end)

1 Like

I think you can just use Status.Changed since it’s a valueObject. You don’t need to use GetService with ReplicatedStorage either. In order to transfer a boolean into text use tostring(). example: topStatus.Text=tostring(Status.Value)

2 Likes

So would this be my script?

local replicatedStorage = game.ReplicatedStorage

local Status = replicatedStorage:WaitForChild(“Status”)

local topStatus = script.Parent:WaitForChild(“TopStatus”)

topStatus.Text=tostring(Status.Value)

Status:GetPropertyChangedSignal(“Value”):Connect(function()

topStatus.Text=tostring(Status.Value)

end)

Not the issue, :GetPropertyChangedSignal("Value") will do the job.

Also, I believe you can’t display boolean values in TextLabels right away. You need to convert the boolean value to a string before setting it as the text.

local replicatedStorage = game:GetService("ReplicatedStorage")
local Status = replicatedStorage:WaitForChild("Status")
local topStatus = script.Parent:WaitForChild("TopStatus")

topStatus.Text = tostring(Status.Value)

Status:GetPropertyChangedSignal("Value"):Connect(function()
    topStatus.Text = tostring(Status.Value)
end)

Also not sure about this thing, I haven’t tested this out yet.

P.S: Also, next time when posting a script, use 3 backticks ( ` ) at the beginning and the end and paste your code between them. It will be more legible.

2 Likes

I don’t believe you read my post properly. I never claimed GetPropertyChangedSignal to be the issue.

1 Like

That script is not working could you please assist me further?

The script seems fine to me.
Any errors?
Is it a Script or a LocalScript?

1 Like

Try just using .Changed? [30 chars]

Also, this may act like :GetPropertyChangedSignal():

Status.Changed:Connect(function(p)
    if p == "Value" then
        topStatus.Text = tostring(Status.Value)
    end
end)

Maybe you need to keep checking for a change in the value?

Whenever I do something like that I do this.

while true do
	wait()
	script.Parent.Text = game:GetService("ReplicatedStorage"):WaitForChild("Val").Value
end

The value I put is
image

I get this:

I honestly don’t think while true do loops would be good for this, .Changed already does the job.

1 Like

It is a LocalScript. So is that bad?

1 Like

I don’t think so, most of the people recommend using LocalScripts while interacting with Guis.

I used a LocalScript and used this code, and it didn’t work so what’s the problem?

local Status = replicatedStorage:WaitForChild("Status")
local topStatus = script.Parent:WaitForChild("TopStatus")

Status.Changed:Connect(function(p)
    if p == "Value" then
        topStatus.Text = tostring(Status.Value)
    end
end)

Explorer image please? [30 char]

I re-done it to use Changed. I agree it’s better.

local repStorage = game:GetService("ReplicatedStorage")

repStorage:WaitForChild("Val").Changed:Connect(function()
	script.Parent.Text = repStorage:WaitForChild("Val").Value
end)
2 Likes

You actually forgot tostring(), it is necessary, because i honestly think an error will appear.

So my StringValue changes its value every second but here’s an image.Screen Shot 2020-05-16 at 11.39.34 AM

Explorer image please… [30 charss]

Ok sorry here is my explorer image.

1 Like

Whoops I quoted him. lol (30 characters)