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)
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)