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

Can't get the "if v.Character.Shirt.ShirtTemplate" to work properly?

Asked by
Xl5Xl5 65
8 years ago

So what this script does; When player is within the distance which is 8 it will check if the player has any of the tools out that all works fine, but I want it to also to detect if the player is wearing a certain shirt.

I wore the shirt if v.Character.Shirt.ShirtTemplate == "http://www.roblox.com/asset/?id=256939149"and that works.. if I am only wearing that shirt...

However if I am not wearing that shirt it won't appear when I enter.. the shirt will instantly disappear without considering the distance from the player to the part.

What I want to happen, example; The player is within the distance of the part, if the player is wearing the shirt OR has any of the tools then make the GUI visible.

I hope I didn't confuse anyone.. Please help!?

brick = script.Parent
distance = 8
local newThread = coroutine.create(function()
    while wait() do
        for i, v in pairs(game.Players:GetPlayers()) do
            if v.Character and v.Character.Torso and (v.Character.Torso.Position - brick.Position).magnitude < distance then
                    if v.Character.Shirt.ShirtTemplate == "http://www.roblox.com/asset/?id=256939149"
                    or v.Character:FindFirstChild("A")
                    or v.Character:FindFirstChild("B")
                    or v.Character:FindFirstChild("C")
                    or v.Character:FindFirstChild("D")
                    or v.Character:FindFirstChild("E") 
                    then v.PlayerGui.Warning.Frame.Visible = true
                    end
            end
            if v.Character and v.Character.Torso and (v.Character.Torso.Position - brick.Position).magnitude > distance then
                v.PlayerGui.Warning.Frame.Visible = false
            end
            end
        end
    end)

coroutine.resume(newThread)

Answer this question