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

Trash Can PLEASE WORK?

Asked by 10 years ago

It's supposed to take a Empty Cup from a players inventory then put it on top of a tray. Can you help fix it?

local mugs = script.Parent.Parent.Mugs local M1,M2,M3,M4,M5,M6,M7,M8 = mugs.M1,mugs.M2,mugs.M3,mugs.M4,mugs.M5,mugs.M6,mugs.M7,mugs.M8 local enabled = true local create = Instance.new

function RandPart(obj1) local parts = {} for _,v in pairs(obj1:GetChildren()) do table.insert(parts, v) end return parts[math.random(1,#parts)] end

script.Parent.ClickDetector.MouseClick:connect(function(player) if player:GetRankInGroup(1107003) == 0 then if script.Parent.Parent.Mugs.M8.Transparency == 0 then MugsInvis() y = player.Backpack z = game.Lighting.Tray z:Clone().Parent = y player.Character.Humanoid:EquipTool(z)
end end end)

script.Parent.Touched:connect(function(h) if h.Parent ~= nil and h.Parent.Name == "Mug" and h.Parent.Trash.Value == true then if enabled then enabled = false if M1.Transparency == 1 then M1.Transparency = 0 enabled = true h.Parent:Destroy() elseif M2.Transparency == 1 then M2.Transparency = 0 enabled = true h.Parent:Destroy() elseif M3.Transparency == 1 then M3.Transparency = 0 enabled = true h.Parent:Destroy() elseif M4.Transparency == 1 then M4.Transparency = 0 enabled = true h.Parent:Destroy() elseif M5.Transparency == 1 then M5.Transparency = 0 enabled = true h.Parent:Destroy() elseif M6.Transparency == 1 then M6.Transparency = 0 enabled = true h.Parent:Destroy() elseif M7.Transparency == 1 then M7.Transparency = 0 enabled = true h.Parent:Destroy() elseif M8.Transparency == 1 then M8.Transparency = 0 enabled = true h.Parent:Destroy() else local h = create("Hint", Workspace) h.Text = "Employee needed to wash mugs" wait(4) h:Destroy() enabled = true end end end end)

function MugsInvis() for _,v in pairs(script.Parent.Parent.Mugs:GetChildren()) do if v:IsA("BasePart") then v.Transparency = 0 end end end

Answer this question