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

Player tool giver does not work in filtering enabled?

Asked by 6 years ago

I made a tool giver which does give to the player when their name is inputted however, because of filtering enabled, the player receiving cannot see or interact with the tool. This is in a local script and is activated by using a GUI panel.

Here is the script:

script.Parent.MouseButton1Click:connect(function()

    script.Parent.Parent.Parent.UsernameToGive.Value = script.Parent.Parent.Username.Text


        if script.Parent.Parent.Parent.RoomType.Value == "Standard Room" then

        if game.Workspace.StandardRooms:FindFirstChild(script.Parent.Parent.Room.Text).Value == false then

        if script.Parent.Parent.Username.Text == "" or script.Parent.Parent.Room.Text == "" then
            script.Parent.Parent.Status.Text = "Not a valid username and/or room number! Try Again!"

        else

            local SeeIfRoomIsPresent = game.Workspace.StandardRooms:FindFirstChild(script.Parent.Parent.Room.Text)
            local SeeIfPlayerIsTrue = game:GetService("Players"):FindFirstChild(script.Parent.Parent.Username.Text)

            if SeeIfRoomIsPresent ~= nil then

                if SeeIfPlayerIsTrue ~= nil then

                    local neededplayer = game.Players:FindFirstChild(script.Parent.Parent.Parent.UsernameToGive.Value)
            local key1 = game:GetService("Lighting").RoomKey:Clone()
            key1.Parent = game.Players[script.Parent.Parent.Username.Text]:WaitForChild("Backpack")

            game.Workspace.StandardRooms:FindFirstChild(script.Parent.Parent.Room.Text).Value = true

            key1.Handle.Card.RoomNumber.Value = script.Parent.Parent.Room.Text
            key1.Handle.Card.Username.Value = script.Parent.Parent.Username.Text
            key1.Name = "Room: "..script.Parent.Parent.Room.Text

                elseif SeeIfPlayerIsTrue == nil then
                    script.Parent.Parent.Status.Text = "Player Does Not Exist"

                end
            elseif SeeIfRoomIsPresent == nil then

                script.Parent.Parent.Status.Text = "Room Does Not Exist"





            end

        end

            end

        elseif game.Workspace.StandardRooms:FindFirstChild(script.Parent.Parent.Room.Text).Value == true then
            script.Parent.Parent.Status.Text = "Room is taken!"
        end


        ------------------------------- FOR SUITES -----------------------------------------------------------------------




        if script.Parent.Parent.Parent.RoomType.Value == "Suite Room" then

        if game.Workspace.SuiteRooms:FindFirstChild(script.Parent.Parent.Room.Text).Value == false then


        if script.Parent.Parent.Username.Text == "" or script.Parent.Parent.Room.Text == "" then
            script.Parent.Parent.Status.Text = "Not a valid username and/or room number! Try Again!"

        else

            local SeeIfRoomIsPresent = game.Workspace.SuiteRooms:FindFirstChild(script.Parent.Parent.Room.Text)
            local SeeIfPlayerIsTrue = game:GetService("Players"):FindFirstChild(script.Parent.Parent.Username.Text)

            if SeeIfRoomIsPresent ~= nil then

                if SeeIfPlayerIsTrue ~= nil then

                    local neededplayer = game.Players:FindFirstChild(script.Parent.Parent.Parent.UsernameToGive.Value)
            local key1 = game:GetService("Lighting").RoomKey:Clone()
            key1.Parent = game.Players[script.Parent.Parent.Username.Text]:WaitForChild("Backpack")

            game.Workspace.SuiteRooms:FindFirstChild(script.Parent.Parent.Room.Text).Value = true

            key1.Handle.Card.RoomNumber.Value = script.Parent.Parent.Room.Text
            key1.Handle.Card.Username.Value = script.Parent.Parent.Username.Text
            key1.Name = "Room: "..script.Parent.Parent.Room.Text

                elseif SeeIfPlayerIsTrue == nil then
                    script.Parent.Parent.Status.Text = "Player Does Not Exist"

                end
            elseif SeeIfRoomIsPresent == nil then

                script.Parent.Parent.Status.Text = "Room Does Not Exist"





            end

        end

            end

        elseif game.Workspace.StandardRooms:FindFirstChild(script.Parent.Parent.Room.Text).Value == true then
            script.Parent.Parent.Status.Text = "Room is taken!"
        end



end)

Any help is appreciated. Thanks.

0
Fix your code up its messy thanks. Additionally do not use Lighting as storage. This is not 2008. User#19524 175 — 6y

1 answer

Log in to vote
1
Answered by
angeI1001 123
6 years ago

Here's an example I can give you (this is a serverscript):


game:GetService("Players").PlayerAdded:Connect(function(Player) local Tools = script.Tools:GetChildren() wait(3) for _,v in pairs(Tools) do if v:IsA("Tool") then v:Clone().Parent = Player:FindFirstChild("StarterGear") v:Clone().Parent = Player:FindFirstChild("Backpack") wait() end end end)
Ad

Answer this question