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

Any Suggestions For my GUI that Will Not Load on Respawn?

Asked by
M39a9am3R 3210 Moderation Voter Community Moderator
8 years ago

I have a script I have been trying to make, and it does not want to seem to make a GUI show up on respawn. This is basically what I have (This is not the whole script since the entire script is 300 lines long).

local re = game:GetService('ReplicatedStorage'):FindFirstChild('********') or game:GetService('ReplicatedStorage'):WaitForChild('********')
script.Parent = nil
print('Report Gui: Connected To Server')

local main=nil
local disabled=false
local players={}
local abuses={'Glitching','Obscenities','Team Killing','Admin Impersonation','Ban Evasion','Harassment','Exploitation','Vandalism','Other (Give Description)'}


function Button()
repeat wait() until game:GetService('Players').LocalPlayer:FindFirstChild('PlayerGui')
local ScreenGui = Instance.new('ScreenGui',game:GetService('Players').LocalPlayer:FindFirstChild('PlayerGui'))

local ReportButton = Instance.new('TextButton',ScreenGui)
ReportButton.BackgroundColor3 = Color3.new(1,1,1)
ReportButton.BorderSizePixel = 0
ReportButton.Position = UDim2.new(0,5,1,-55)
ReportButton.Size = UDim2.new(0,90,0,50)
ReportButton.Style = Enum.ButtonStyle.RobloxRoundDropdownButton
ReportButton.Font = Enum.Font.SourceSansBold
ReportButton.FontSize = Enum.FontSize.Size14
ReportButton.Text = 'Report'
ReportButton.TextColor3 = Color3.new(0.76862752437592,0.15686275064945,0.10980392992496)
ReportButton.TextStrokeColor3 = Color3.new(0.15686275064945,0.15686275064945,0.15686275064945)
ReportButton.TextStrokeTransparency = 0.80000001192093
ReportButton.TextWrapped = true
ReportButton.Active = not disabled

return {ScreenGui,ReportButton}
end

function Load()
    repeat wait() until game:GetService('Players').LocalPlayer:FindFirstChild('PlayerGui')
    main = Button()
    main[2].MouseButton1Click:connect(function()
        if not disabled then
        for _,v in pairs(game.Players:GetChildren()) do table.insert(players,#players+1,{v.Name,v.userId}) end
        MainGui()
        end
    end)
end

game:GetService('Players').LocalPlayer.CharacterAdded:connect(function() Load() end) Load()

If anyone knows why the GUI will not load on respawn, I would greatly appreciate a fix. The reason I can't fix it myself is because I don't know what's going wrong, and there are absolutely no errors. Thank you for the help!

0
Have you tried putting in a manual wait after line 34 to check if it's something else that hasn't loaded yet? It may also have to do with the for loop on lines 38-40, the table part might cause a problem. GoldenPhysics 474 — 8y
0
Just now tried it, didn't seem to work. Hmmm... UPDATE: Give me a minute... I'm not getting a up to date server. Confirmed, didn't work. M39a9am3R 3210 — 8y
0
Wouldn't putting that gui in StarterGui make it reappear every time a player respawns? Marios2 360 — 8y

Answer this question