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

Inserting A GUI?

Asked by 9 years ago

I'm making a mainframe for the Pinewood Builders HQ. I made a script for inserting a gui into the localplayer. When I tried it, it didn't work.

Here is my code:

game.Players.localplayer.PlayerGui.InsertInstance:(180091578)

This did not work for me, this is about my first time scripting.

3 answers

Log in to vote
1
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
9 years ago

What you're looking for is the InsertService service.

Since I assume this is a normal Script, you can't use LocalPlayer, either

game:GetService("InsertService"):LoadAsset(180091587).Parent = game.Players:GetPlayerFromCharacter(hit.Parent).PlayerGui
Ad
Log in to vote
0
Answered by 9 years ago

Please note that I will be using it in this working script.

Access = {"KeepOnBuilding","Phirexx"}

function checkOkToLetIn(name) 
    for i = 1,#Access do 
        if (string.upper(name) == string.upper(Access[i])) then return true end 
    end 
    return false 
end 

local Door = script.Parent
function onTouched(hit) 
    print("Door Hit") 
    local human = hit.Parent:findFirstChild("Humanoid") 
    if (human ~= nil ) then 
        print("Human touched door") 
        if (checkOkToLetIn(human.Parent.Name)) then 
            print("Human passed test") 
            Door.SurfaceGui.W.Visible = false
            Door.SurfaceGui.A.Visible = true
                       (Script to insert goes here)
            wait(3)
            Door.SurfaceGui.A.Visible = false
            Door.SurfaceGui.W.Visible = true
        else 
            Door.SurfaceGui.W.Visible = false
            Door.SurfaceGui.D.Visible = true
            wait(3)
            Door.SurfaceGui.D.Visible = false
            Door.SurfaceGui.W.Visible = true
        end 
    end 
end 

script.Parent.Touched:connect(onTouched)
0
Please edit your Question to include additional info in the future, don't Answer your Question with it. adark 5487 — 9y
Log in to vote
-1
Answered by 9 years ago

That game.Players.localplayer.PlayerGui.InsertInstance:(180091578) you said did not work? Actually localplayer is supposed to be LocalPlayer.

If it helps then Congrats :D

Answer this question