i have it on local script here is the code should the script be in the gui because i have it in the part when you click it it works but it wont refresh i dont know
local RefreshTime = script.Parent.Refresh.Value script.Parent.ClickDetector.MouseClick:Connect(function(player) local Textlabelforthingy = player.PlayerGui.ScreenGui.TextLabel Textlabelforthingy.Text = "the part has been clicked" end) local function RefreshText() local Textlabelforthingy = player.PlayerGui.ScreenGui.TextLabel Textlabelforthingy.Text = "." end while true do wait(RefreshTime) RefreshText() end
Try using MouseButton1Click
instead of MouseClick
. Also, use game.Players.LocalPlayers
. Try this:
local RefreshTime = script.Parent.Refresh.Value script.Parent.MouseButton1Click:Connect(function() local Textlabelforthingy = game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel Textlabelforthingy.Text = "the part has been clicked" end) local function RefreshText() local Textlabelforthingy = game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel Textlabelforthingy.Text = "." end while true do wait(RefreshTime) RefreshText() end
Also, make sure that the script's parent is a TextButton
.
Here is my answer, if this works make sure to accept the answer:
local RefreshTime = script.Parent.Refresh.Value script.Parent.MouseButton1Click:Connect(function() local Textlabelforthingy = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.TextLabel Textlabelforthingy.Text = "the part has been clicked" end) local function RefreshText() local Textlabelforthingy = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.TextLabel Textlabelforthingy.Text = "." end while true do RefreshText() wait(RefreshTime) end