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

Function not working properly?

In this function, the two new instances (ScreenGui and Frame) are both created as they should be and when I test it in game the size is set for the Frame (as again it should be), however I cannot see the frame.

function stuff(part)
	if not game.StarterGui:FindFirstChild("ScreenGui") then
	local sc = Instance.new("ScreenGui", game.StarterGui)
	wait (0.1)
	local fr = Instance.new("Frame", game.StarterGui.ScreenGui)
	game.StarterGui.ScreenGui.Frame.Size = UDim2.new{0, 100},{0, 100}
	end
end
script.Parent.ClickDetector.MouseClick:connect(stuff)

1 answer

local playerGui = game.Players.LocalPlayer.PlayerGui


function stuff(part)
    if not game.StarterGui:FindFirstChild("ScreenGui") then
    local sc = Instance.new("ScreenGui", playerGui)
    wait (0.1)
    local fr = Instance.new("Frame",  sc)
    fr.Size =  UDim2.new(0, 100, 0, 100)
    end
end
script.Parent.ClickDetector.MouseClick:connect(stuff)

Try this.

3 comments

0

It looks like the size has been set when I check the properties whilst testing, but I still can't see it (for example, it will show up if I do it all in Studio)

0

Try that

0

@64batsalex , It is best to explain your answer to give the asker a better understanding of what's going on!

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