Hello! I’m working on a project for a group and I feel like I shouldn’t be this stuck. This is just simply when a player touches the door, it gives them group clothes. But, for some reason, these clothes are not given. Not sure if what I’m doing is wrong(probably) or if Roblox is having trouble with loading assets. Either way, I’m stuck. If possible please help!
local open = script.Parent.Open
local debounce = false
script.Parent.Trigger1.Touched:Connect(function(p)
if debounce == false then
debounce = true
if p.Parent:FindFirstChild("StaffCard") ~= nil then
if open.Value == false then
local player = tostring(p.Parent)
local children = workspace:FindFirstChild(player)
if children:FindFirstChild("Shirt") == nil then
local shirt = Instance.new("Shirt", children)
shirt.Name = "Shirt"
print("giving shirt")
else
print("player has a shirt")
end
local rank = game.Players:FindFirstChild(player):GetRankInGroup(6017147)
if rank < 6 and rank >= 12 then
print("would give LowRank+ shirt.")
workspace:FindFirstChild(player):FindFirstChild("Shirt").ShirtTemplate = "rbxassetid://5059324295"
workspace:FindFirstChild(player):FindFirstChild("Pants").PantsTemplate = "rbxassetid://5184185481"
elseif rank > 12 then
print("would give HighRank+ shirt.")
workspace:FindFirstChild(player):FindFirstChild("Shirt").ShirtTemplate = "rbxassetid://5059324295"
workspace:FindFirstChild(player):FindFirstChild("Pants").PantsTemplate = "rbxassetid://3869153810"
end
local f = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,math.rad(90),0)
for i = 0,1,0.1 do
local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f,i)
script.Parent.Door1:SetPrimaryPartCFrame(cfm)
wait()
end
open.Value = true
wait(3)
local f3 = script.Parent.Door1.PrimaryPart.CFrame*CFrame.Angles(0,-math.rad(90),0)
for i = 0,1,0.1 do
local cfm = script.Parent.Door1.PrimaryPart.CFrame:lerp(f3,i)
script.Parent.Door1:SetPrimaryPartCFrame(cfm)
wait()
end
open.Value = false
end
else
print("error")
end
debounce=false
end
end)