Problem with GUI spawn [SOLVED]

well i dont think there’s anything left to blame on the script, check on the TextLabel itself, maybe some properties like Visible is unchecked?

Yep, everything’s checked out. Visible = true and TextTransparency = 0
The funny part is that it tweens and goes properly when I access the TextLabel ITSELF. I added the :Clone() part to prevent bugs from happening. Like the Label getting stuck in the middle.

FOUND IT! i think this is gonna work now, according to the documentation, when you clone an instance, it copies the object and parents it to nil, so try to parent it to the GUI.

Doesn’t work. Sorry.

man the 30 letters thing is so annoying

hm, can you show your script after editing it?

local descendants = game:GetDescendants()

local player = game.Players.LocalPlayer

local TweenService = game:GetService("TweenService")

local warning = script.Parent.warning

local Tween1 = TweenInfo.new(1, Enum.EasingStyle.Quint, Enum.EasingDirection.Out)
local Tween2 = TweenInfo.new(1, Enum.EasingStyle.Back, Enum.EasingDirection.In)

local function tweenWarning(text)
	local clone = warning:Clone()
	clone.Parent = game.StarterGui.thingie
	clone.Text = text
	TweenService:Create(clone, Tween1, {Position = UDim2.new(0.5, 0, 0.8, 0)}):Play()
	wait(1)
	TweenService:Create(clone, Tween2, {Position = UDim2.new(0.5, 0, 1, 0)}):Play()
end


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
				tweenWarning("Removed "..tools.Name)
				tools:Destroy()
				print("somethingsomethinge")
			else
				print("there's no tool to clear")
			end
		end)
	end
end

well thats not how you parent the thing to the player’s Gui, you should learn more about Player Gui.

Here’s an optimized code:

local gui = script.Parent -- assuming the Script is the script Named "LocalScript"
local function tweenWarning(text)
	local clone = warning:Clone()
   task.wait()
	clone.Parent = gui
	clone.Text = text
	TweenService:Create(clone, Tween1, {Position = UDim2.new(0.5, 0, 0.8, 0)}):Play()
	wait(1)
	TweenService:Create(clone, Tween2, {Position = UDim2.new(0.5, 0, 1, 0)}):Play()
end

Sorry, not really a pro at coding yet :smiling_face_with_tear:

yea its okay, tell me if it works now

OMG IT WORKS THANK YOU SO MUCH!

Seriously thought, thanks for your time. :+1:

1 Like

im really glad that i’ve helped you, good luck on your game!!

1 Like