Help for a pulling a string from game

I’m making a simple sword fighting game. The gui script that I wrote does not work as intended.

local Status = game:GetService("ReplicatedStorage"):WaitForChild("Status")

script.Parent.text = Status.Value

Status:GetPropertyChangedSignal("Value"):Connect(function(Status)
	
	script.Parent.text = Status.Value
	print("Change")
	
end)

I need someone to tell me what I did wrong. The script is a local script that is pulling a value from the string “status” and changing the text on the gui to what the string status is. While the game is running the status changes but not the gui. The 3rd line of code is for pulling the status when the game opens, but after it pulls the string there it does not pull it anymore.

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Try it without the “Value” in GetPropertyChangedSignal(“Value”)
iirc. “Value” is the default thing for all the *Value instances, so you wouldn’t need to specify it and might be overriding it somehow.

I tried adding value in testing and forgot to remove it while posting.

you spelled Text wrong. try this:

script.Parent.Text = Status.Value

The text on the gui bar still does not change when I changed text to uppercase.

Fixed! I tested this out in my own place and discovered that your function parameter is overlapping with your variable.

local Status = game:GetService("ReplicatedStorage"):WaitForChild("Status")

script.Parent.Text = Status.Value

Status:GetPropertyChangedSignal("Value"):Connect(function() -- I removed "Status" in the function parameter, it works just fine without

	script.Parent.Text = Status.Value
	print("Change")

end)

Status.Value = 2 -- Original value = 1
1 Like

Thank you it works perfectly! Btw it took me 6 days to get on the deform to ask for help so thank you.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.