The function of this script is well, nothing much. The gui originally is telling the player to not click it. Then when clicked it should display "I've been clicked!" then, after one second, say "Don't click me (count that goes up each time it's been clicked)."
How would I go about changing it from what it is right now for it to work?
local screenGui = Instance.new("ScreenGui")
screenGui.Parent = game.Players.LocalPlayer.PlayerGui
r=1
local textButton = Instance.new("TextButton")
textButton.Parent = screenGui
textButton.Size = UDim2.new(0, 300, 0, 100)
textButton.Text = "Don't click me, " .. game.Players.LocalPlayer.Name .. "!"
local xPosition = 1
local speed = 0.005
while true do
xPosition = xPosition - speed
textButton.Position = UDim2.new(xPosition, 0, 0, 0)
if xPosition < -0.1 then
xPosition = 1
end
wait()
end
textButton.MouseButton1Down:connect(function()
textButton.Text = "I've been clicked!"
wait(1)
textButton.Text = "Don't Click Me Again!" .. r + 1
end)
Also, is there any way to make this script smaller/more efficient or well made? And finally, how would I change the font size, and type?
EDIT: How can I also reference something in a script from another script?

2 comments
I'm getting an error: "Clicked is not a valid member of TextButton"
Ah, my bad. I will edit.