Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

my stringvalue is not updating?

I have tried so many ways to make this work and its just not happening. I am using a remote function to send the data from a LocalScript to a Script here is the LocalScript:

	local info = {
			diseasename = textbox.Text,
			player = player
		}
		game.ReplicatedStorage.Diseasecreated:InvokeServer(info)

and here is the Script:

game.ReplicatedStorage.Diseasecreated.OnServerInvoke = function(player,info)
	
	local diseasename = info.diseasename
	local player = info.player
	
	print(diseasename)
	print(player)
	local stat = player.leaderstats.diseasename.Value
	stat = diseasename
	print(stat)
end

At the print(stat) it does print the correct stat, but it doesn't show in the leaderboard or in the .Value in properties. I am not really good at scripting, could anyone help me?

2 comments

0

Maybe you should try with a remote event

0

try diseasenname = stat

1 answer

✓ Accepted answer

I think you aren’t updating the stat correctly. When you change it to stat = diseasename it doesn’t change the value to the name but instead changes it to the already defined diseasename.


game.ReplicatedStorage.Diseasecreated.OnServerInvoke = function(player,info)

    local diseasename = info.diseasename
    local player = player -- the first argument is always player

    print(diseasename)
    print(player)
    local stat = player.leaderstats.diseasename
    stat.Value = diseasename
    print(stat.Value)
end

Hope this helps.

1 comment

0

it worked, thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.