So basically, I am trying to make a script which removes all the items from the player’s inventory using a ProximityPrompt through a LocalScript (because I want a TextLabel to show up saying which item you removed). My code goes like this:
local descendants = game:GetDescendants()
for _, descendant in pairs(descendants) do
if descendant:IsA("ProximityPrompt") and descendant.Name == "trashPrompt" then
print("foundPrompt")
descendant.Triggered:Connect(function()
local tools = player.Backpack:FindFirstChildOfClass("Tool") or player.Character:FindFirstChildOfClass("Tool")
if not tools then
player.Character.ChildAdded:Wait()
player.Backpack.ChildAdded:Wait()
end
if tools:IsA("Tool") or tools:IsA("HopperBin") then
tools:Destroy()
tweenWarning("Removed"..tools.Name)
else
print("there's no tool to clear")
end
end)
end
end
The problem with THIS is that it completes the function properly, but the TextLabel doesn’t show up at ALL. (I also tried using Instance.new and TweenPosition, had the same result)
local function tweenWarning(text)
local clone = warning:Clone()
clone.Text = text
clone:TweenPosition(UDim2.new(0.5,0,0.8,0),"Out","Quint",0.2)
wait(1)
clone:TweenPosition(UDim2.new(0.5,0,1,0),"In","Back",0.2)
end
The main problem is that an error shows up: Can only tween objects in the workspace
@vyexon and @666demonical999 that option doesn’t work, still does the same thing. I checked the Visible and it was set to true; TextTransparency was also set to 0