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

Script will not work?

Asked by 10 years ago
function clicked()
    game.StarterGui.ScreenGui.Frame.Mes.Text = "<efgde"
end
script.Parent.MouseButton1Down:connect(clicked)

Trying to make this script work, but it wont change the TextLabel(Mes) to efdge I have tried this in both a regular script and a localscript.

1 answer

Log in to vote
2
Answered by 10 years ago

If you want an immediate change, use PlayerGui, as StarterGui will just change the gui when you 'reset'.

Here's how you would do it in a LocalScript:

local plrgui = game.Players.LocalPlayer.PlayerGui

if plrgui ~= nil then --Just in case the player clicks too soon
    plrgui.ScreenGui.Frame.Mes.Text = "<efgde"
end

And in a Click script:

script.Parent.MouseButton1Down:connect(function()
    local plrgui = game.Players.LocalPlayer.PlayerGui

    if plrgui ~= nil then --Just in case the player clicks too soon
        plrgui.ScreenGui.Frame.Mes.Text = "<efgde"
    end
end)

If this helped please accept the answer :)

0
Do I put both of those scripts in? My_Comment 95 — 10y
0
Well I was really just explaining it in the first one, but the second one will work if you put it in the TextButton. systematicaddict 295 — 10y
Ad

Answer this question