Script to change a value in player

Hello!
So I’m an absoloute novice when it comes to scripting, and i need some help.
This is a script that, when it’s parent button is clicked, should change the value of the ‘Role’ string value in the player. It doesn’t seem to be working, could I please have some help

local player = game.Players.LocalPlayer
local role = player:FindFirstChild("Role")
script.Parent.MouseButton1Click:Connect(function()
	role.Value = "Original"
	script.Parent.Parent.Parent.Visible =  false
end)

If you only want the client to see it then this should work, but if you want the server to access this then I would recommend using remote events. When the button is clicked send a remote event to the server and change the role from there. Hope this helps.

I recommend reading this article:

It’s important to understand the fundamentals before tackling problems that could involve replication.

There is a number of things that could be problematic here, but if you can answer these, then this thread can be solved much faster:

  • What type of script is this? (LocalScript / Script)
  • Is the script existing correctly within the environement’s hierarchy? (LocalScript should exist somewhere client-sided, script should exist somewhere server-sided)

Answering these will help us solve your problem.