Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Value is not changing when clicked on button?

Asked by
UEm1R 9
6 years ago

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

Log in to vote
0
Answered by 6 years ago

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!

0
ty UEm1R 9 — 6y
Ad

Answer this question