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

FiliteringEnabled and RemoteEvents, how do I access PlayerGui from ServerScriptService?

Asked by
4xN 10
7 years ago

So, I am trying to make a button that changes a team and also changes a Value, which is in PlayerGui. Using remoteevetns, I am trying to figure out how to change something in the PlayerGui from the script in ServerScriptService. Is there anybody who could tell me how to do this?

Here's something I wrote up similar to what I am trying to do:

Script in ServerScriptService (Script):

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local TestEvent = Instance.new("RemoteEvent")
TestEvent.Parent = ReplicatedStorage
TestEvent.Name = "TestEvent"

local function TestEventRequest(player,TestValue)
player.TeamColor = BrickColor.new("Bright red")
TestValue = "Red"
end
TestEvent.OnServerEvent:Connect(TestEventRequest) 

Script in TextButton (LocalScript):

function click()
local TestValue = script.Parent.Parent.Parent.TestValue.Value
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Test = ReplicatedStorage:WaitForChild("TestEvent")
wait (0.02)
Test:FireServer(TestValue)
end
script.Parent.MouseButton1Down:connect(click)

0
Why not access PlayerGui inside click() .... cabbler 1942 — 7y
0
Because there are certain things I can only do in ServerScriptStorage that I can't do in PlayerGui and I need variables from the script in order for the script to work the way I would like for it to. 4xN 10 — 7y
0
If you can't simply use a value in ReplicatedStorage then use a remote function instead of a remote event. cabbler 1942 — 7y

Answer this question