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

Perform on Player Respawn and Fix Only Workspace?

Asked by
Moxeh 84
9 years ago

I need to make it so this works anywhere such as StarterGui and StarterGear. Also, how do I make it so it clones the GUI into the player.PlayerGui every time he/she respawns?

Model Hierarchy: http://imgur.com/u2Fybab

local Model = script.Parent
local Settings = script.Parent.Configuration
    game.Players.PlayerAdded:connect(function(player)
--Check if new player is admin      
    for v,numberObject in pairs(Settings.AdminList:GetChildren()) do
        if numberObject.Value == player.userId then
wait()
--Check to see if Dev has Model already
if Model.Parent == player.StarterGear then
end
--If not in StarerGear then put it there if in correct instance
if Model.Parent == game.ServerStorage then
    Model:clone().Parent = player:WaitForChild("StarterGear")
    Model:clone().Parent = player:WaitForChild("PlayerGui")
end
--If not in correct instance put it there
    if Model.Parent ~= game.ServerStorage then
--AutoMover Enabled
        if Settings.AutoMover.Value == true then
            Model.Parent = game.ServerStorage
            Model:clone().Parent = player:WaitForChild("StarterGear")
            Model:clone().Parent = player:WaitForChild("PlayerGui")
            else if Model.Parent == game.ServerStorage then
                Model:clone().Parent = player:WaitForChild("StarterGear")
                Model:clone().Parent = player:WaitForChild("PlayerGui")
--AutoMover Disabled
        else if Settings.AutoMover.Value == false then
            if Model.Parent == game.ServerStorage then
                Model:clone().Parent = player:WaitForChild("StarterGear")
                Model:clone().Parent = player:WaitForChild("PlayerGui")
            else if Model.Parent ~= game.ServerStorage then
                print 'Enable the AutoMover in EncryptX Secret GUI'
            end 
        end
    end
        end
    end
        end
    end
    end
    end)

Answer this question