Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[Solved] this gui is not showing up for everyone but myself, how do i fix this?

This works on my screen but no one else is seeing it.
(this script is a local script inside StarterGui)

local player = game.Players.LocalPlayer -- gets to the local player

local character = player.Character  -- gets to the character

local playergui = player:WaitForChild("PlayerGui")  -- gets to the playergui

local Gui = script.BATB:Clone()  --clones the gui 

playergui.Control.TextButton.MouseButton1Down:connect(function()  -- triggers the script when button is pressed

script.BATB.FrameLoader.Text = player.Name.. " Has entered the controls" -- puts text inside the text box

script.BATB.LocalScript.Disabled = false -- enables script

Gui.Parent = playergui  -- put gui inside playergui
end)
	

2 answers

✓ Accepted answer

Hello the reason it's only showing you it's because the script playergui.Control.TextButton.MouseButton1Down function is ran locally

Heres a quick fix:

Script (place a script in ServerScriptService)

local remote = Instance.new("RemoteEvent",game.ReplicatedStorage)
remote.Name = "ControlsUpdateText"

remote.OnServerEvent:Connect(function(player,text)
	remote:FireAllClients(player.Name.." Has entered the controls")
end)

LocalScript (edit ur localscript to this)

local player = game.Players.LocalPlayer -- gets to the local player

local character = player.Character  -- gets to the character

local playergui = player:WaitForChild("PlayerGui")  -- gets to the playergui

playergui.Control.TextButton.MouseButton1Down:connect(function()  -- triggers the script when button is pressed
	game.ReplicatedStorage:WaitForChild("ControlsUpdateText"):FireServer(player.Name.. " Has entered the controls")
end)

game.ReplicatedStorage:WaitForChild("ControlsUpdateText").OnClientEvent:Connect(function(text)
	local Gui = script.BATB:Clone()  --clones the gui 

	script.BATB.FrameLoader.Text = text -- puts text inside the text box

	script.BATB.LocalScript.Disabled = false -- enables script

	Gui.Parent = playergui  -- put gui inside playergui
end)

Feel free to comment if there's any errors, or anything.

6 comments

0

sadly, it still only shows for me and not for anyone else. (no errors)

0

What only shows for you?

0

Give me more information.

0

The gui thats parented to the local script. (trying to make it clone into the playergui so everyone can see it)

0

Why don't you just put it in the playergui and enable it with a script later when you need it? Isn't that easier?

0

Vitrox#0329 my discord , add me so we don't have to talk here.

This is because you're doing it inside of a Local Script. If you want this code to be server sided then you'll need to use a Server Script. You'll need a RemoteEvent for this also.

Heres the code, I've already tested it and it works, but if it doesn't work for you for whatever reason, just post a comment below and I'll try to help you.

Local Script:


local Player = game.Players.LocalPlayer

local PlayerGui = Player:WaitForChild("PlayerGui")

local RemoteEvent = game.ReplicatedStorage.RemoteEvent

local Gui = script.BATB:Clone()

PlayerGui.Controls.TextButton.MouseButton1Down:Connect(function()

	RemoteEvent:FireServer()

	Gui.Parent = PlayerGui
	
end)

Server Script:

local RemoteEvent = game.ReplicatedStorage.RemoteEvent

RemoteEvent.OnServerEvent:Connect(function(Player)
	
	local Players = game:GetService("Players") 
	
	for i,v in pairs(Players:GetChildren()) do -- Here we are getting all the players that are currently in the game
		
		local PlayerGui = v:FindFirstChild("PlayerGui") -- Getting all Players' PlayerGuis.
		local FrameLoader = PlayerGui:FindFirstChild("FrameLoader") -- Change this to where the location of the FrameLoader is inside of the players' PlayerGui
		FrameLoader.Text = Player.Name.." Has entered the controls" -- Changing the FrameLoader's Text for everyone in the game.
	
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.