Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My refreshing gui isnt working and i dont know how to fix it??

Asked by 5 years ago

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

01local RefreshTime = script.Parent.Refresh.Value
02 
03script.Parent.ClickDetector.MouseClick:Connect(function(player)
04    local Textlabelforthingy = player.PlayerGui.ScreenGui.TextLabel
05    Textlabelforthingy.Text = "the part has been clicked"
06end)
07 
08local function RefreshText()
09    local Textlabelforthingy = player.PlayerGui.ScreenGui.TextLabel
10    Textlabelforthingy.Text = "."
11end
12 
13while true do
14    wait(RefreshTime)
15    RefreshText()
16end
0
You can't have a clickdetector in a gui srimmbow 241 — 5y
0
script should be in gui, when you use the clickdetector, fire client to refresh oilkas 364 — 5y
0
no theres a part in the workspace QuestionableScript3r -6 — 5y

2 answers

Log in to vote
1
Answered by 5 years ago

Try using MouseButton1Click instead of MouseClick. Also, use game.Players.LocalPlayers. Try this:

01local RefreshTime = script.Parent.Refresh.Value
02 
03script.Parent.MouseButton1Click:Connect(function()
04    local Textlabelforthingy = game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel
05    Textlabelforthingy.Text = "the part has been clicked"
06end)
07 
08local function RefreshText()
09    local Textlabelforthingy =  game.Players.LocalPlayer.PlayerGui.ScreenGui.TextLabel
10    Textlabelforthingy.Text = "."
11end
12 
13while true do
14    wait(RefreshTime)
15    RefreshText()
16end

Also, make sure that the script's parent is a TextButton.

0
its not working QuestionableScript3r -6 — 5y
0
Instead of using game.Players use game:getService("Players") that might help marine5575 359 — 5y
0
and you never declared player, try opening the output panel, this will help with errors marine5575 359 — 5y
0
sorry for misreading it there is no player marine5575 359 — 5y
0
sorry for misreading it there is no player marine5575 359 — 5y
Ad
Log in to vote
0
Answered by 5 years ago

Here is my answer, if this works make sure to accept the answer:

01local RefreshTime = script.Parent.Refresh.Value
02 
03script.Parent.MouseButton1Click:Connect(function()
04    local Textlabelforthingy = game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.TextLabel
05    Textlabelforthingy.Text = "the part has been clicked"
06end)
07 
08local function RefreshText()
09    local Textlabelforthingy =  game:GetService("Players").LocalPlayer.PlayerGui.ScreenGui.TextLabel
10    Textlabelforthingy.Text = "."
11end
12 
13while true do
14    RefreshText()
15    wait(RefreshTime)
16end
0
it does not QuestionableScript3r -6 — 5y

Answer this question