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

How would you make a tool giving gui filtering enabled compatible?

Asked by 6 years ago

I have a tool here, You click a player and their name is then moved into a value. Then when you press the button seen in the code it would give them the specified tool.

Local Script:

wait(2)

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local debounce = false
local target = nil

mouse.Move:connect(function()
    target = mouse.Target
    if not target or not (target.Parent:findFirstChild("Humanoid")) then
        if player.PlayerGui:findFirstChild("MouseText") then
            player.PlayerGui.MouseText.TextLabel.Text = ""
        end
    else
        if not (player.PlayerGui:findFirstChild("MouseText")) then
            local mouseGui = Instance.new("ScreenGui",player.PlayerGui)
            mouseGui.Name = "MouseText"
            local mouseText = Instance.new("TextLabel",mouseGui)
            mouseText.Size = UDim2.new(0,10,0,10)
            mouseText.BackgroundTransparency = 1
            mouseText.TextXAlignment = "Left"
            mouseText.TextStrokeTransparency = 0
            mouseText.TextColor3 = Color3.new(255,255,255)
        end
        if player.PlayerGui:findFirstChild("MouseText") then
            if target.Parent:IsA("Hat") then
                player.PlayerGui.MouseText.TextLabel.Text = target.Parent.Parent.Name
            else
                player.PlayerGui.MouseText.TextLabel.Text = target.Parent.Name
            end
            player.PlayerGui.MouseText.TextLabel.Position = UDim2.new(0,mouse.X+10,0,mouse.Y-5)
            mouse.Button1Down:connect(function()
                if target.Parent:findFirstChild("Humanoid") then
                    if debounce == false then
                        debounce = true
                        if target.Parent:IsA("Hat") then

                            script.Parent.Parent.GivePE.Text = " "..target.Parent.Parent.Name
                            script.Parent.Parent.GivePE.PlayerName.Value = target.Parent.Parent.Name


                        else

                            script.Parent.Parent.GivePE.Text = ""..target.Parent.Name
                            script.Parent.Parent.GivePE.PlayerName.Value = target.Parent.Name


                        end
                        wait(0.1)
                        debounce = false
                    end
                end
            end)
        end
    end
end)




script.parent.parent.GivePE.MouseButton1Down:connect(function()
script.parent.RemoteEvent:FireServer()

end)








Normal Script



local ToolPath1 = game.ReplicatedStorage.Cart script.parent.RemoteEvent.OnServerEvent:connect(function() if ToolPath1 then local plr = game.Players:FindFirstChild(script.Parent.Parent.GivePE.PlayerName.Value) ToolPath1:Clone().Parent = plr:WaitForChild("Backpack") end end)

Answer this question