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

Function not working properly?

Asked by 9 years ago

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

Log in to vote
0
Answered by 9 years ago
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.

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) laffydecious 10 — 9y
0
Try that 64batsalex 45 — 9y
0
@64batsalex , It is best to explain your answer to give the asker a better understanding of what's going on! minikitkat 687 — 9y
Ad

Answer this question