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

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

Asked by
Seyfert 90
8 years ago
Edited 8 years ago

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

0
Is FE on? If so, scripts can't access PlayerGui. Also, you should be putting the Fame,TextButton, and ImageButton in the ScreenGui. User#11440 120 — 8y
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. Seyfert 90 — 8y

1 answer

Log in to vote
0
Answered by 8 years ago

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.
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? Seyfert 90 — 8y
Ad

Answer this question