I have made a gui which consists of a textbox and a button, When the text is entered and button pressed it changed a value. I need this value to be updated in the leaderboard, But can't seem to have it change the leaderboard in game. The leaderboard is for a player rank in a certain group, And it works by inputting the group ID. Below is the code, Any help would be appreciated.
id = game.Workspace.tt.Value game.Players.PlayerAdded:connect(function(D) repeat wait() until D:findFirstChild("leaderstats") local Rank = Instance.new("StringValue", D.leaderstats) Rank.Name = "Raiders" print (id) Rank.Value = D:GetRoleInGroup(id) end)
To achieve this purpose you can do one of two things, a changed event or a GetPropertyChangedSignal function
the GetPropertyChangedSignal
function, or the event returned by it fires when the property given as a parameter changes. While the changed
event fires when almost any property of an instance changes. the GetPropertyChangedSignal function is prefered against the changed event when listening to only one property, as it can be needlessly expensive to listen to all property changes to listen for a change to a specific property. However, if it is something like an IntValue, StringValue, or ObjectValue object, use of the Changed event is prefered as it is shorter and there is only one logical property that you should be listening to changes on.
For your purpose, I'm going to assume the value is a boolean value
BoolVal.Changed:Connect(function(newValue) if newValue == true then ... end end)
If it isn't a "Value object", you can use the GetPropertyChangedSignal
function like such:
local property = ""SomeProperty Thing:GetPropertyChangedSignal(property):Connect(function() if Thing[property] = "Something" then ... end end)