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

Help with problem with player finding script activating?

Asked by 9 years ago

Hi,

This script is meant to search for a person when their name is typed in and then see if they have a certain t-shirt on and then print them a pass and name them.

The thing is, when you type in the name and press the button, it does not work and it is as if it has no script in it at all! I am not sure how to fix this!

Please help!

Here is the script:

running = false
status = script.Parent.Parent.Status
shirt = "175379651"
pass = game.Lighting.First
passClone = nil

script.Parent.MouseButton1Click:connect(function()
    if running == false then
        running = true
        user = script.Parent.Parent.Player.Text
        wait(1)
        status.Text = ("Searching for " .. user)
        player = game.Players:FindFirstChild(user)
        if player == nil then
            status.Text = (user .. " was not found")
        else    
            wait(2)
            status.Text = (user .. " was found")
            wait(2)
            status.Text = ("Searching " .. user .. "'s inventory")
            wait(2)
            if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, shirt) then
                status.Text = (user .. " has the " .. script.Parent.Name .. " ticket")
                wait(2)
                status.Text = ("Printing boarding pass")
                wait(2)
                passClone = pass:Clone()
                passClone.Parent = player.Backpack
                passClone.Handle.Gui.Logo.Image = script.Parent.Parent.Logo.Image
                passClone.Handle.Gui.Airline.Text = script.Parent.Parent.Airline.Text
                passClone.Handle.Gui.Flight.Text = script.Parent.Parent.Destination.Text
                passClone.Handle.Gui.Gate.Text = script.Parent.Parent.Gate.Text
                passClone.Handle.Gui.DTime.Text = script.Parent.Parent.DTime.Text
                character = player.Character
                model = Instance.new("Model", character)
                model.Name = (player.Name .. " || " .. script.Parent.Name .. " Class")
                head = character.Head:Clone()
                head.Parent = model
                humanoid = Instance.new("Humanoid", model)
                humanoid.MaxHealth = 0
                humanoid.Health = 0
                weld = Instance.new("Weld", head)
                weld.Part0 = head
                weld.Part1 = character.Head
                character.Head.Transparency = 1
                status.Text = ("Boarding pass printed")
                wait(2)
            else
                status.Text = (user .. " has not got the " .. script.Parent.Name .. " ticket")
                wait(2)
                game:GetService("MarketplaceService"):PromptPurchase(player, shirt)
                wait(2)
                status.Text = (script.Parent.Name .. " ticket prompted to " .. user)
                wait(2)
            end
        end
        running = false
        status.Text = ("Ready to check-in passengers")
    end
end)

Answer this question