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

Why do I get this strange error?[EDITED]

Asked by
NRCme 0
8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

My game works local but running it on the server I get this error:

CMPTR is not a valid member of ScreenGui

local button = script.Parent
local startgui = button.Parent.Parent
local player = game.Players.LocalPlayer
local plyrgui = player.PlayerGui
local l = startgui.Buttons
local comp = plyrgui.Buttons.CMPTR
local compF = comp.Frame
local compT = comp.TextLabel

local function onButtonClick()

    print("Play Button Clicked")    

    l.PlayBut:Destroy()

    l.HelpBut:Destroy()

    l.AboutBut:Destroy()

    --compF.Size = UDim2.new(0, 900, 0, 450)
    --compF.Position = UDim2.new(0, 300, 0, 50)
    --compT.Size = UDim2.new(0, 850, 0, 400)
    --compT.Position = UDim2.new(0, 325, 0, 75)

    compT:TweenSizeAndPosition(UDim2.new(0, 850, 0, 400), UDim2.new(0, 275, 0, 75), "Out", "Quad", 1)
    compF:TweenSizeAndPosition(UDim2.new(0, 900, 0, 450), UDim2.new(0, 250, 0, 50), "Out", "Quad", 1)

end

button.MouseButton1Click:connect(onButtonClick)

I have looked over: https://scriptinghelpers.org/blog/it-works-in-studio-but-not-online a bit

Why do I get the error? Thankyou in advance!

0
Is this a localScript? theCJarmy7 1293 — 8y
0
Yes NRCme 0 — 8y
0
try :WaitForChild() not everything loads when the player does wackem 50 — 8y
0
^ User#11440 120 — 8y
0
I added that in but I still get the error :/ NRCme 0 — 8y

Answer this question