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

[Solved] Why Wont basic remote event create GUI?

Asked by
Fad99 286 Moderation Voter
5 years ago
Edited 5 years ago

I have done Debugging and the code is running with no error and the GUI's are being stored in the right place. Is there a certain property of the UI's i should change?

Code is as follows (There is nothing in the fire all clients side):

local rep = game.ReplicatedStorage.RemoteEvent
rep.OnClientEvent:Connect(function()
local GUI = Instance.new("ScreenGui")
local Text = Instance.new("TextBox")

Text.Text = "Fart"
GUI.Parent = game.StarterGui
Text.Parent = GUI

wait(2)
print(Text.Parent.Parent)
end)

2 answers

Log in to vote
0
Answered by
Fad99 286 Moderation Voter
5 years ago

[Solved] I needed to give the text box a size parameter with Udim2

Ad
Log in to vote
-1
Answered by
wilduk -2
5 years ago

LocalScript that is needed to start the Event can't reach ReplicatedStorage, try moving Event into the workspace, script into event and instead of putting Gui in the StarterGui put it in PlayerGui to prevent giving player same gui a few times.

Script(inside event):

local rep = game.ReplicatedStorage.RemoteEvent
rep.OnClientEvent:Connect(function(plr)
local GUI = Instance.new("ScreenGui")
local Text = Instance.new("TextBox")
Text.Text = "Fart"
GUI.Parent = game.Players.plr.PlayerGui
Text.Parent = GUI
end)

LocalScript(StarterPlayer > StarterPlayerScript/StarterCharacterScript):

workspace.RemoteEvent:FireServer()
1
What. The. Heck. DeceptiveCaster 3761 — 5y
1
This is very wrong. LocalScripts can access ReplicatedStorage from anywhere in the game. DeceptiveCaster 3761 — 5y
0
sorry then :< wilduk -2 — 5y

Answer this question