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

How to make a player GUI go into a Value in workspace?

Asked by 5 years ago

I tried to make this script but I know it won't work, can you guys show me how to make a remote event for this please thanks!

while true do
game.Workspace.thing.Value = game,Players.superbolt999.PlayerGUI.Answer.Frame.Q1.Text
wait(1)
end

thing is a string value in workspace keep superbolt999 since that is all that will be using this game.

0
try using a GetPropertyChanged signal function and a Remote Event instead of an infinite loop theking48989987 2147 — 5y
0
game,Players? WideSteal321 773 — 5y

1 answer

Log in to vote
0
Answered by
Amiaa16 3227 Moderation Voter Community Moderator
5 years ago

Not sure why do you need to set a value in workspace to a text from a player's gui. Generally you shouldn't do that, but since you didn't provide any more details, do the following:

Connect to the Q1:GetPropertyChangedSignal("Text") event of the Q1. Inside the event handler fire a remote which will set the value of the "thing" to the text.

Example:

Client

local plr = game:GetService("Players").LocalPlayer
local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

local Q1 = plr.PlayerGui.Answer.Frame.Q1
Q1:GetPropertyChangedSignal("Text"):Connect(function()
    remote:FireServer(Q1.Text)
end)

Server

local remote = game:GetService("ReplicatedStorage"):WaitForChild("RemoteEvent")

remote.OnServerEvent:Connect(function(plr, text)
    workspace.thing.Value = text
end)
Ad

Answer this question