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

Why does this only work in Play here and not the actual game?

Asked by 5 years ago

So basically this is supposed to pop up a GUI when you click it, heres the code. The GUI is in StarterGUI

debounce = false
msg = script.Parent.MessageToShow.Value

function Clicked(plr)
    if debounce == false then

        plr.StarterGui.InfoPanel.ScrollingFrame:TweenPosition(UDim2.new(0.5, -250,0.5, -200, 'Out', 'Bounce', 1))
    debounce = true
    else
    plr.StarterGui.InfoPanel.ScrollingFrame:TweenPosition(UDim2.new(-0.5, -250,0.5, -200, 'Out', 'Bounce', 1))
    debounce = false
       plr.StarterGui.InfoPanel.ScrollingFrame.Visible = true
        plr.StarterGui.InfoPanel.ScrollingFrame.InfoText.Text = msg
        debounce = false
end
    end

script.Parent.ClickDetector.MouseClick:connect(Clicked)

1 answer

Log in to vote
0
Answered by 5 years ago

there can be 2 reasons, depending on which script you used.

if you used a server script it won't work in server cause you can't modify gui stuff with a server script and have to use a local script for that.

Otherwise if you used a local script, I'm assuming you put it in workspace cause I see you're using click detectors. Well... local script don't execute in workspace.

Since you're using click detectors, you have to use a server script. Now what you can do is fire a remote to client to change gui stuff.

for more info on remote events and converting stuff to FE try checking out these links: this and this

Ad

Answer this question