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

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

Asked by 8 years ago
Edited 8 years ago

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

01local tool = script.Parent
02local plr = game.Players.LocalPlayer
03local gui1 = game.ReplicatedStorage.ControlsGui
04local controlsGui1 = plr.PlayerGui:FindFirstChild("ControlsGui")
05 
06tool.Equipped:connect(function()
07    tool.rMovement.Disabled=true
08    tool.lMovement.Disabled=true
09    local plr=game.Players:findFirstChild(tool.Parent.Name)
10    if plr and tool.Parent:findFirstChild("Humanoid") and not controlsGui1 then
11        controlsGui1=gui1:Clone()
12        controlsGui1.Parent=plr.PlayerGui --this is the error it says..
13    end
14    controlsGui1:WaitForChild('TextButton').Visible = true
15    if tool.HandValue.Value==1 then
16        tool.lMovement.Disabled=false
17    else tool.rMovement.Disabled=false
18    end
19end)

Client Log Says This:

Picture

1 answer

Log in to vote
0
Answered by 8 years ago

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.

Ad

Answer this question