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

Everything works fine in this script. But it does not clone to the players GUI?

Asked by 5 years ago

So what I am trying to do is, if a admin speaks and says ":givescoreboard (name)" then it would see if that name is valid. But for some reason it does not clone the GUI to the person. Why is that?

local admins = {"dogovpain","RandamuHaise","Player1","6trxshankles9","RoberttOriginal"}
local scoreboardValues = game.Workspace.ScoreboardValues

game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
        if msg:sub(1, 16) == ":givescoreboard " then
        for i = 1,#admins do
        if plr.Name == admins[i] then
        local addPlayer = msg:sub(17, msg:len())    
        print(addPlayer)
        if game.Players:FindFirstChild(addPlayer) then
            print("Player has been found")
            table.insert(admins, addPlayer)
            for i,v in pairs(game.Players:GetPlayers()) do
                if v.Name == admins[i] then
                    if v.PlayerGui:FindFirstChild("ManualGui") then
                    v.PlayerGui:FindFirstChild("ManualGUI"):Destroy() 
                    wait()
                    local manual = script.ManualGUI:Clone()
                    manual.Parent = v.PlayerGui
                end
                end
                end
        else 
            print("Player has not been found")
                end
             end
          end
       end
    end)
end)

game.Players.PlayerAdded:Connect(function(player)
    local playerGui = player.PlayerGui
    for i = 1,#admins do
        if player.Name == admins[i] then
            local manualGui = script:WaitForChild("ManualGUI")
            local cloneGuiToPlayer = manualGui:Clone()
            cloneGuiToPlayer.Parent = playerGui
            if playerGui:FindFirstChild("ManualGUI") then return end
        end
    end
end)

0
That is because the server cannot see PlayerGui. PlayerGui is only visible to the client. You will need to use remote events. Also a tip/suggestion. Use the admins' user ID instead of their name as if they change their name they will no longer be admins in the game. valchip 789 — 5y
0
Also you can clone things from a place to the player's PlayerGui. Even tho the server can't see the instances inside the player's PlayerGui, it can see the folder however so that means that you can put Guis there. valchip 789 — 5y
0
uhhhh WillBe_Stoped 71 — 5y
0
if i fire the event where do i clone the maual gui cause i cant get it from serverscriptservice lol. WillBe_Stoped 71 — 5y

1 answer

Log in to vote
0
Answered by
Imperialy 149
5 years ago

server

event:FireClient(player)

client

event.OnClientEvent:Connect(function()
    frame.Visible = true
end)
0
but the gui doesnt clone to the player WillBe_Stoped 71 — 5y
0
so? this is teaching him the setup Imperialy 149 — 5y
Ad

Answer this question