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

Cloning from ReplicatedStorage to PlayerGui?

Asked by 7 years ago

I have trouble trying to finish the script, or at least get to where I understand what I'm suppose to do next.

local RepStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local plr = Players.LocalPlayer
local playerGui = plr:WaitForChild("PlayerGui")
local controlGuiClass = RepStorage:WaitForChild("ControlsGui")

tool.Equipped:connect(function()
    tool.rMovement.Disabled=true
    tool.lMovement.Disabled=true
    if plr and tool.Parent:findFirstChild("Humanoid") and not controlGuiClass then
        local function newControlGui()
        local controlGui = controlGuiClass:Clone() --whenever i test it, it won't be placed in the PlayerGui
        controlGui.Parent = playerGui
        return controlGui
        end
    local controlGui = newControlGui()
    controlGuiClass:WaitForChild('TextButton').Visible = true --this eventually doesn't show up
    if tool.HandValue.Value==1 then
        tool.lMovement.Disabled=false
    else tool.rMovement.Disabled=false
    end
    end
end)

I was told using booleans something along the lines of this:

button.MouseButton1Click:connect(function()
    frame.Visible = not frame.Visible
end)

Thanks,

LukeGabrieI aka EnergyBrickz

1 answer

Log in to vote
1
Answered by 7 years ago

first, I have no idea what this script is, server script or local script.

If LocalScript then take a look at this script I made;

local plr = game.Players.LocalPlayer
local Gui = game.ReplicatedStorage:WaitForChild("SomeGui")
local tool = script.Parent

tool.Equipped:connect(function()
    local NewGui = Gui:Clone()
    NewGui.Parent = plr.PlayerGui
end)

This will clone a gui to the player gui when the tool is equipped, try adding this code on, if it helped please accept answer :D

Ad

Answer this question