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 8 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.

01local RepStorage = game:GetService("ReplicatedStorage")
02local Players = game:GetService("Players")
03local plr = Players.LocalPlayer
04local playerGui = plr:WaitForChild("PlayerGui")
05local controlGuiClass = RepStorage:WaitForChild("ControlsGui")
06 
07tool.Equipped:connect(function()
08    tool.rMovement.Disabled=true
09    tool.lMovement.Disabled=true
10    if plr and tool.Parent:findFirstChild("Humanoid") and not controlGuiClass then
11        local function newControlGui()
12        local controlGui = controlGuiClass:Clone() --whenever i test it, it won't be placed in the PlayerGui
13        controlGui.Parent = playerGui
14        return controlGui
15        end
View all 23 lines...

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

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

Thanks,

LukeGabrieI aka EnergyBrickz

1 answer

Log in to vote
1
Answered by 8 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;

1local plr = game.Players.LocalPlayer
2local Gui = game.ReplicatedStorage:WaitForChild("SomeGui")
3local tool = script.Parent
4 
5tool.Equipped:connect(function()
6    local NewGui = Gui:Clone()
7    NewGui.Parent = plr.PlayerGui
8end)

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