while true do --point Create local Point = Instance.new("TextButton") Point.Parent = game.StarterGui.ScreenGui Point.Visible = true Point.Size = UDim2.new(0, 50, 0, 50) --color Point.BackgroundColor3 = Color3.new(255/255, 255/255, 255/255) --Location local xPos = math.random(23,1840) local yPos = math.random(180, 950) Point.AnchorPoint = Vector2.new(xPos, yPos) Point.Position = UDim2.new(0, xPos, 0, yPos) print("x : ",xPos," y : ",yPos) --delete wait(5) Point.MouseButton1Click:Connect(function() Point:Remove() end) end
This is my script there is no error or error code. So what's the problem you might ask. Well the TextButton is generated in the ScreenGui but it is not showing up. I tried to set the code to white as you can see but it won't show up. This is the URL to the picture of the TextBox how it is looking.
https://lh3.googleusercontent.com/-P6fU1D46MqY/XqPJcRWPO3I/AAAAAAAAA34/NF-L479cD3Uh2JBID_DvRJoxN-WkqVJXwCK8BGAsYHg/s0/2020-04-24.png
So like you saw the box is still there and will appear when you click it. But it won't show up. Please help me...
Mabye you can change the Instance.new()
to game:GetService()
I don't actually know. This is just a theory. I hope I helped.
Sincerely,
Ducksneedhelp - Scripting Noob
Hello! I have an answer to your question. I had problem with that too, once. So basically, when you add an object to starter GUI, it doesn't actually update the player's GUI. Here is how to fix it:
local player = game.Players.LocalPlayer -- The player that has this script. while true do --point Create local Point = Instance.new("TextButton") Point.Parent = player.PlayerGui -- Changed this to PlayerGui Point.Visible = true Point.Size = UDim2.new(0, 50, 0, 50) --color Point.BackgroundColor3 = Color3.new(255/255, 255/255, 255/255) --Location local xPos = math.random(23,1840) local yPos = math.random(180, 950) Point.AnchorPoint = Vector2.new(xPos, yPos) Point.Position = UDim2.new(0, xPos, 0, yPos) print("x : ",xPos," y : ",yPos) --delete wait(5) Point.MouseButton1Click:Connect(function() Point:Remove() end) end
Your problem was that you added it into the starter GUi, which only shows up when the game starts or the player resets. So, to fix that, use the current player's GUI. Which is player.PlayerGui