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

Does anyone know why the gui isn't poping up? Does anyone has a solution?

Asked by 5 years ago
Edited 5 years ago

this is a script in a team and it's a local script. So the GUI is going into the backpack but in a game u have this and it's working? Why isn't it working with me? I want that if a player is sleected that u see the GUI ? Does anyone what is bad?

local active = true
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local down = true
local selection = Instance.new("SelectionBox")
selection.Parent = player.PlayerGui
selection.Color3 = Color3.new(1, 235, 0)

mouse.Move:Connect(function()
    if active == true then
        local target = mouse.Target
        if not target then
            selection.Adornee = nil
        elseif game.Players:GetPlayerFromCharacter(target.Parent) then
            selection.Adornee = target.parent
        else
            selection.Adornee = nil
        end

    end
end)

mouse.Button1Down:Connect(function()
    local tar = mouse.Target
    if not game.Players:GetPlayerFromCharacter(tar.Parent) or not tar then
        selection.Adornee = nil
        local player = game.Players:FindFirstChild(tar.Parent)
        script.Parent.Frame.Visible = false
        script.Parent.Main.Visible = false
        active = true
    elseif game.Players:GetPlayerFromCharacter(tar.Parent) then
        active = false
        script.Parent.username.Value = tar.Parent.Name
        script.Parent.Frame.Visible = true
        script.Parent.Main.Visible = true
    end
end)



AnimateEvent = game.ReplicatedStorage.PoliceGui
AnimateEvent.OnClientEvent:Connect(function(arg)
    if script.Parent:FindFirstChild(arg) then
        script.Parent[arg]:TweenPosition(UDim2.new(0, -300, 0.8, -100), Enum.EasingDirection.Out, Enum.EasingStyle.Quad)
    end
end)

0
You cant use Instance.new("", Parent) It is deprecated, use selection.Parent herrtt 387 — 5y
0
What do u mean? MaxDev_BE 55 — 5y
0
He means that the Parent argument is decaperated, so u gotta do the Instance.new("") alone and then set the Parent of the Instance User#23365 30 — 5y
0
Whatr line? MaxDev_BE 55 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago
local active = true
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local down = true
local selection = Instance.new("SelectionBox")
selection.Parent = player.PlayerGui
selection.Color3 = Color3.new(1, 235, 0)

mouse.Move:Connect(function()
    if active == true then
        local target = mouse.Target
        if not target then
            selection.Adornee = nil
        elseif game.Players:GetPlayerFromCharacter(target.Parent) then
            selection.Adornee = target.parent
        else
            selection.Adornee = nil
        end

    end
end)

mouse.Button1Down:Connect(function()
    local tar = mouse.Target
    if not game.Players:GetPlayerFromCharacter(tar.Parent) or not tar then
        selection.Adornee = nil
        local player = game.Players:FindFirstChild(tar.Parent)
        script.Parent.Frame.Visible = false
        script.Parent.Main.Visible = false
        active = true
    elseif game.Players:GetPlayerFromCharacter(tar.Parent) then
        active = false
        script.Parent.username.Value = tar.Parent.Name
        script.Parent.Frame.Visible = true
        script.Parent.Main.Visible = true
    end
end)



AnimateEvent = game.ReplicatedStorage.PoliceGui
AnimateEvent.OnClientEvent:Connect(function(arg)
    if script.Parent:FindFirstChild(arg) then
        script.Parent[arg]:TweenPosition(UDim2.new(0, -300, 0.8, -100), Enum.EasingDirection.Out, Enum.EasingStyle.Quad)
    end
end)

Ad

Answer this question