-
What do you want to achieve?
I am trying to loop trought each objects in the workspace. -
What is the issue? Include screenshots / videos if possible!
The problem is that the if statement is not working, its supposed to print every
“Right Leg” and “Left Leg” models. -
What solutions have you tried so far?
--[[
Frames positions:
Opened: {0.34, 0},{0.327, 0}
Closed : {0.34, 0},{1.3, 0}
]]--
-- Made by Beez_up
-- Some npc's have a click detector on and are'nt suposed to have one?
-- Add the npc's name here:
local blacklist = {'Enter npc name that you dont want to work.'}
-- Don't touch from here
local ishirt
local mps = game:GetService("MarketplaceService")
local plr = game.Players.LocalPlayer
local char = script.Parent.WeldFrame.Character.Char
local frame = script.Parent.WeldFrame
local id
local template
local function clearCloths()
char.Shirt.ShirtTemplate = ''
char.Pants.PantsTemplate = ''
end
local function prompt(id)
mps:PromptPurchase(plr,id)
end
local frame =script.Parent.WeldFrame
-- Function that returns true if the argument passed is a player
local function isPlayer(char)
local name = char.Name
if not char:FindFirstChild'Humanoid' then return end
if game.Players:FindFirstChild(name) then
return true
elseif table.find(blacklist,char.Name) then
warn('\''..char.Name .. '\' is black listed!')
return true
else
return false
end
end
local function open()
frame:TweenPosition(UDim2.new(0.34, 0,0.327, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Bounce,.4,false,nil)
end
local function close()
frame:TweenPosition(UDim2.new(0.34, 0,1.3, 0),Enum.EasingDirection.Out,Enum.EasingStyle.Bounce,.4,false,nil)
end
for _,value in pairs(workspace:GetDescendants()) do
if value:FindFirstChild('Left Leg') then -- Not working from there
if not value:FindFirstChild("Torso") then
if value:FindFirstChild("Right Leg") then
print(value.Name)
end
end
end
end
frame.Close.MouseButton1Up:Connect(close)
frame["Buy Text"].MouseButton1Up:Connect(function()
mps:PromptPurchase(plr,tonumber(id))
end)
frame["Try On Text"].MouseButton1Up:Connect(function()
game:GetService("ReplicatedStorage").Events.Wear:FireServer(template,ishirt )
end)
Thanks for reading!