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

Why is my script refusing to run anything after print() ?

Code is below, the script is inside "ServerScriptService"

print("running")
for i, v in pairs(game.Players:GetChildren()) do
	local player = v:FindFirstChild("PlayerGui")
	local shopgui = Instance.new('ScreenGui', player)
	local frame = Instance.new('Frame', player)
	local textbutton = Instance.new('TextButton', player)
	local imagebutton = Instance.new('ImageButton', player)
	imagebutton.Position = UDim2.new(0.98, 0, 0.75, 0)
	imagebutton.Size = UDim2.new(0, 250, 0, 100)
end

2 comments

0

Is FE on? If so, scripts can't access PlayerGui. Also, you should be putting the Fame,TextButton, and ImageButton in the ScreenGui.

0

FE is enabled, however I have another script that is similar to this one and it is making scripts into PlayerGUI just fine. I see them appear in PlayMode. I did not realize I did not put the Frame inside of ScreenGui, maybe that is why they are not appearing.

1 answer

Your not putting the Frame into the ScreenGui

You need to put the Frame, TextButton, and ImageButton in to the ScreenGui.

print("running")
for i, v in pairs(game.Players:GetChildren()) do
    local player = v:FindFirstChild("PlayerGui")
    local shopgui = Instance.new('ScreenGui', player)
    local frame = Instance.new('Frame', shopgui)
    local textbutton = Instance.new('TextButton', frame)
    local imagebutton = Instance.new('ImageButton', frame)
    imagebutton.Position = UDim2.new(0.98, 0, 0.75, 0)
    imagebutton.Size = UDim2.new(0, 250, 0, 100)
end
Mess around with the size.

Side Note,

Scripts, while FE is enabled, can't access things in PlayerGui that the script didn't make. However, since you're making the GUIs, this should, hopefully, work.

Good Luck!

If I helped, please don't forget to accept my answer.

1 comment

0

This is incredibly strange. My script I posted in OP won't run on its own but if I put in a loop such as "while true do" it will work and make the GUI. Why is this?

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