Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

3 comments

0

You can't have a clickdetector in a gui

0

script should be in gui, when you use the clickdetector, fire client to refresh

0

no theres a part in the workspace

2 answers

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.

5 comments

0

its not working

0

Instead of using game.Players use game:getService("Players") that might help

0

and you never declared player, try opening the output panel, this will help with errors

0

sorry for misreading it there is no player

0

sorry for misreading it there is no player

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

1 comment

0

it does not

This discussion is preserved as it was. New answers, comments, and votes are closed.