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

GUI Not Popping Up Anymore? (ROBLOX Updates??)

This script works in the client, but not in a server. It used to work, I don't know why it's not working.

local tool = script.Parent
local plr = game.Players.LocalPlayer
local gui1 = game.ReplicatedStorage.ControlsGui
local controlsGui1 = plr.PlayerGui:FindFirstChild("ControlsGui")

tool.Equipped:connect(function()
	tool.rMovement.Disabled=true
	tool.lMovement.Disabled=true
	local plr=game.Players:findFirstChild(tool.Parent.Name)
	if plr and tool.Parent:findFirstChild("Humanoid") and not controlsGui1 then
		controlsGui1=gui1:Clone()
		controlsGui1.Parent=plr.PlayerGui --this is the error it says..
	end
    controlsGui1:WaitForChild('TextButton').Visible = true
	if tool.HandValue.Value==1 then
		tool.lMovement.Disabled=false
	else tool.rMovement.Disabled=false
	end
end)

Client Log Says This:

Picture

1 answer

Minor notes: findFirstChild is deprecated in favour of FindFirstChild (most if not all Roblox functions are now supposed to be capitalized). Line 9 could be removed; you already have the LocalPlayer from line 2.

The warning about the Infinite yield could be the issue. Make sure you actually have a gui named "ControlsGui" - if you changed even a single letter of it (ex, to "ControlGui"), Roblox won't find it anymore, and that would explain the output. If it's working as intended, you might want to silence those warnings by providing a very large timeout (ex 1/0 evaluates to infinity and seems to work as expected).

If that's not the problem, then I'd say that there's a discrepancy between the output you've shown us and the script. The output shows an error in CloneGui and ControlsGui with errors that could not possibly have come from this script.

If this isn't the full script and, say, on line 30 you use controlsGui1 (which would line up with the error message), don't forget that controlsGui1 could be nil after line 4.

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