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

Value is not changing when clicked on button?

So i got a localscript in a textbutton (the textbutton is located in GUI -> Frame), when i press on the button in Roblox Studio it changes but when i go in-game via the website and press on the button it won't change?

Value name = P

plr = game.Players.LocalPlayer

function onClicked()
	
plr.P.Value = 5

end

script.Parent.MouseButton1Down:connect(onClicked)

1 answer

✓ Accepted answer

Hi!

Seems like you're trying to change a server-value via a LocalScript, which isn't possible :( To fire functions that operate on a server-level, try using a RemoteEvent, this allows you to fire functions from a LocalScript, whilst executing them on the server.

The reason it works on studio is that ROBLOX Studio's test function plays on a local server, meaning any changes you see there only change for the one executing it.

Examples of Server-functions are: TeamChange, Respawn Character, Teleport, Set Value, etc. If you decide to fire those via a LocalScript, you'll need a RemoteEvent!

I hope it works out, and good luck!

1 comment

0

ty

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