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 4 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

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
0
You can't have a clickdetector in a gui srimmbow 241 — 4y
0
script should be in gui, when you use the clickdetector, fire client to refresh oilkas 364 — 4y
0
no theres a part in the workspace QuestionableScript3r -6 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

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.

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

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
0
it does not QuestionableScript3r -6 — 4y

Answer this question