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

Help me please?! this script won't work outside of studio.

Asked by
Irvene 5
9 years ago

I've put it inside of workspace as local, and regular script. Didn't run

I can't put it insideo f starterpack because its a freaking gamescript

I put it in serverscript service and it only works in studio just like workspace

doesn't do anything for gods sakes I need help..

wait(1)

for i,v in pairs(game.Players:GetChildren()) do
    if v:findFirstChild("PlayerGui") then
        v.PlayerGui.ScreenGui.Background:TweenSizeAndPosition(UDim2.new(0, 2200, 0, 2200), UDim2.new( 0, 0, 0, 0), "Out", "Quad", 1)
        wait(1)
        v.PlayerGui.ScreenGui.ScrollingFrame.Visible = true
    end
end

wait(5)

for i,v in pairs(game.Players:GetPlayers()) do
    if v:findFirstChild("PlayerGui") then
        v.PlayerGui.ScreenGui.Background:TweenSizeAndPosition(UDim2.new(0, 0, 0, 0), UDim2.new( 0, 0, 0, 0), "In", "Quad", 3)
        wait(3)
        v.PlayerGui.ScreenGui.ScrollingFrame.Visible = false
    end
end
0
Local Scripts don't work in workspace. EzraNehemiah_TF2 3552 — 9y
0
Yeah I know it didn't work local or regular.. Irvene 5 — 9y
0
Think logically: You're being repetitive in your code, it looks like you're throwing things together. aquathorn321 858 — 9y

1 answer

Log in to vote
-1
Answered by 9 years ago

Look in the last question you posted for an explanation on the code here. This is the second code block from the top, and this is to be used with a server script (normal script).

game.Players.PlayerAdded:connect(function(player)--Runs whenever a player is added to the game
player.CharacterAdded:connect(function()--Runs whenever a character is added to the game. If you want to have the gui load only once when the character spawns, then leave out CharacterAdded and remove an end)

local ScreenGui = Instance.new("ScreenGui") --Parenting it is not necessary

local Background = Instance.new("Frame")
Background.ZIndex = 1
Background.Size = UDim2.new( 0, 0, 0, 0)
Background.Position = UDim2.new( 0, 0, 0, 0)
Background.Transparency = 0.5
Background.BackgroundColor3 = Color3.new(72/255,72/255,72/255)

local StarterMenu = Instance.new("ScrollingFrame")
StarterMenu.ZIndex = 3
StarterMenu.Size = UDim2.new( 0, 250, 0, 150)
StarterMenu.Position = UDim2.new( 0.5, 0, 0.5, 0)
StarterMenu.Transparency = 0.5
StarterMenu.Visible = false
StarterMenu.BackgroundColor3 = Color3.new(85/255,0/255,0/255)

local ImageText = Instance.new("ImageLabel")
ImageText.ZIndex = 3
ImageText.Image = "rbxassetid://51806623"
ImageText.Size = UDim2.new( 0, 100, 0, 100)
ImageText.Transparency = 1
ImageText.BackgroundColor3 = Color3.new(255/255,255/255,255/255)

ScreenGui.Parent = player.PlayerGui
Background.Parent = ScreenGui
Background:TweenSizeAndPosition(UDim2.new(0, 1000, 0, 1000), UDim2.new( 0, 0, 0, 0), "Out", "Quad", 1)
wait(2)
StarterMenu.Parent = ScreenGui
StarterMenu.Visible = true
ImageText.Parent = ScreenGui
end)--closes CharacterAdded() event
end)--closes PlayerAdded() event
0
The problem is once a player joins itll constantly run that, it's a function.... I want a script that doesn't run it every time something happens. I want it to be a loop. Irvene 5 — 9y
0
Well yeah, it reloads the gui. If a player dies they lose their gui. Have you tested it yet? aquathorn321 858 — 9y
0
I tested it. And if the player dies, they do lose their GUI. I don't want the GUI to be lost though, it needs to stay on the screen, do you know how to do this? Irvene 5 — 9y
0
Yeah: Use character added. That's why it's there. aquathorn321 858 — 9y
Ad

Answer this question