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

An error I dont understand?? Not Valid Member Of ScreenGui?

I have a script. and when ever I do a test it says Open is not a valid member of screen gui. When it clearly is.. heres the script.

local button = script.Parent.Open.TextButton
local upgrade = script.Parent.Upgrade
local player = game.Players.LocalPlayer
local frame = script.Parent.Open
local close = script.Parent.Upgrade.Close
local Floor = script.Parent.Upgrade.Floor
local Time = script.Parent.Time
local Material = script.Parent.Material
local CM = script.Parent.Upgrade.ChangeMaterial
local close1 = script.Parent.Material.Close
local fabric = script.Parent.Material.Fabric
local wannabuy = script.Parent.WannaBuy
local MP = workspace.MainPlat
local CFM = script.Parent.Material.Floor

button.MouseButton1Click:connect(function()
	upgrade:TweenPosition(UDim2.new(0.01, 0, 0.13, 0), "In", "Quad", 1,true)
	frame:tweenPosition(UDim2.new(-0.1, 0, 0.94, 0), "In", "Quad", 1,true)
end)

close.MouseButton1Click:connect(function()
	upgrade:TweenPosition(UDim2.new(-0.1, 0, 0.13, 0), "In", "Quad", 1,true)
	frame:TweenPosition(UDim2.new(0.01, 0, 0.94, 0), "In", "Quad", 1,true)
end)

local text = Time.TextLabel
local platform1 = workspace.Platform1
local platform2 = workspace.Platform2
local platform3 = workspace.Platform3
local platform4 = workspace.Platform4
local platform5 = workspace.Platform5
local platform6 = workspace.Platform6
local platform7 = workspace.Platform7
local platform8 = workspace.Platform8
local platform9 = workspace.Platform9
local platform10 = workspace.Platform10
local platform11 = workspace.Platform11
local platform12 = workspace.Platform12
local platform13 = workspace.Platform13
local platform14 = workspace.Platform14
local platform15 = workspace.Platform15
local platform16 = workspace.Platform16

Floor.MouseButton1Click:connect(function()
	game.Players.LocalPlayer.leaderstats.Players.Value = game.Players.LocalPlayer.leaderstats.Players.Value - 1
	Floor.Visible = false
	Time.Visible = true
	text.Text = "5"
	wait(1)
	text.Text = "4"
	wait(1)
	text.Text = "3"
	wait(1)
	text.Text = "2"
	wait(1)
	text.Text = "1"
	wait(1)
	text.Text = "Upgrading.."
	wait(5)
	local part = Instance.new("Part")
	part.Parent = game.Workspace
	part.Name = "MyLittleUpgrade"
	wait(1)
	platform1.Transparency = 0
	wait(2)
	platform2.Transparency = 0
	wait(2)
	platform3.Transparency = 0
	wait(2)
	platform4.Transparency = 0
	wait(2)
	platform5.Transparency = 0
	wait(2)
	platform6.Transparency = 0
	wait(2)
	platform7.Transparency = 0
	wait(2)
	platform8.Transparency = 0
	wait(2)
	platform9.Transparency = 0
	wait(2)
	platform10.Transparency = 0
	wait(2)
	platform11.Transparency = 0
	wait(2)
	platform12.Transparency = 0
	wait(2)
	platform13.Transparency = 0
	wait(2)
	platform14.Transparency = 0
	wait(2)
	platform15.Transparency = 0
	wait(2)
	platform16.Transparency = 0
	wait(1)
	MP.Transparency = 0
	wait()
	platform1.Transparency = 1
	wait()
	platform2.Transparency = 1
	wait()
	platform3.Transparency = 1
	wait()
	platform4.Transparency = 1
	wait()
	platform5.Transparency = 1
	wait()
	platform6.Transparency = 1
	wait()
	platform7.Transparency = 1
	wait()
	platform8.Transparency = 1
	wait()
	platform9.Transparency = 1
	wait()
	platform10.Transparency = 1
	wait()
	platform11.Transparency = 1
	wait()
	platform12.Transparency = 1
	wait()
	platform13.Transparency = 1
	wait()
	platform14.Transparency = 1
	wait()
	platform15.Transparency = 1
	wait()
	platform16.Transparency = 1
	wait()
	Time.Visible = false
	CM.Visible = true
end)

CFM.MouseButton1Click:connect(function()
	CFM.Visible = false
	fabric.Visible = true
end)

CM.MouseButton1Click:connect(function()
	CM.Visible = false
	Material:TweenPosition(UDim2.new(0.12, 0, 0.13, 0), "In", "Quad", 1,true)
end)

close1.MouseButton1Click:connect(function()
	CM.Visible = true
	Material:TweenPosition(UDim2.new(-0.1, 0, 0.13, 0), "Out", "Quad", 1,true)
end)

fabric.MouseButton1Click:connect(function()
	wannabuy.Visible = true
	wannabuy.Yes.MouseButton1Click:connect(function()
		wannabuy.Visible = false
		MP.Material = "Fabric"
		fabric.Visible = false
		player.leaderstats.Players.Value = player.leaderstats.Players.Value - 1
	end)
	wannabuy.No.MouseButton1Click:connect(function()
		wannabuy.Visible = false
	end)
end)

5 comments

0

:WaitForChild()

0

This script gives me a heart attack

0

Lol, I know its messy. I got the problem fixed though.

0

I think you need to look up loops XD

0

I know how to do loops, I just couldnt do loops on most of it

1 answer

✓ Accepted answer

try using script.Parent:WaitForChild("Open") for every instance the problem is that it hasn't loaded in yet while the script has already started running

2 comments

0

Thanks!!! 1 more question if you mind helping. How do I make it so the blocks/material only pop up for the local player?

0

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