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
01 | local RefreshTime = script.Parent.Refresh.Value |
02 |
03 | script.Parent.ClickDetector.MouseClick:Connect( function (player) |
04 | local Textlabelforthingy = player.PlayerGui.ScreenGui.TextLabel |
05 | Textlabelforthingy.Text = "the part has been clicked" |
06 | end ) |
07 |
08 | local function RefreshText() |
09 | local Textlabelforthingy = player.PlayerGui.ScreenGui.TextLabel |
10 | Textlabelforthingy.Text = "." |
11 | end |
12 |
13 | while true do |
14 | wait(RefreshTime) |
15 | RefreshText() |
16 | end |
Try using MouseButton1Click
instead of MouseClick
. Also, use game.Players.LocalPlayers
. Try this:
01 | local RefreshTime = script.Parent.Refresh.Value |
02 |
03 | script.Parent.MouseButton 1 Click:Connect( function () |
04 | local Textlabelforthingy = game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel |
05 | Textlabelforthingy.Text = "the part has been clicked" |
06 | end ) |
07 |
08 | local function RefreshText() |
09 | local Textlabelforthingy = game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel |
10 | Textlabelforthingy.Text = "." |
11 | end |
12 |
13 | while true do |
14 | wait(RefreshTime) |
15 | RefreshText() |
16 | 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:
01 | local RefreshTime = script.Parent.Refresh.Value |
02 |
03 | script.Parent.MouseButton 1 Click:Connect( function () |
04 | local Textlabelforthingy = game:GetService( "Players" ).LocalPlayer.PlayerGui.ScreenGui.TextLabel |
05 | Textlabelforthingy.Text = "the part has been clicked" |
06 | end ) |
07 |
08 | local function RefreshText() |
09 | local Textlabelforthingy = game:GetService( "Players" ).LocalPlayer.PlayerGui.ScreenGui.TextLabel |
10 | Textlabelforthingy.Text = "." |
11 | end |
12 |
13 | while true do |
14 | RefreshText() |
15 | wait(RefreshTime) |
16 | end |