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

How to get a player to change value using server script?

Asked by 4 years ago

So I want to change a players value without using remote events or ontouched, any help? Here is the script.

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local character = Player.Character or Player.CharacterAdded:Wait()

game.Workspace.CustomizationPartGui.SurfaceGui.FirstName.Alex.MouseButton1Click:connect (function ()
Player:WaitForChild("leaderstats").FirstName.Value = game.Workspace.CustomizationPartGui.SurfaceGui.FirstName.Alex.Text
end)
0
You can only use LocalPlayer on the client Thetacah 712 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

You would have to separate the script with a localscript. You could have a localscript that is disabled as a child of the server script. The localscript will have a string value inside it. The localscript would change the value of the surface gui to the value of the string value.

The server script would clone the disabled localscript, change the stringvalue of the cloned instance, and place in the player you want to change. Then enable the localscript.

But in my opinion, it's much much easier to do this via localscript and not server.

Ad

Answer this question