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

Small change to script breaks the entire thing?

Asked by 9 years ago

heya. I'm trying to make my startup screen for my MMORPG, and I realized that it starts again whenever I die/reset (something I don't want,obviously.)

I've made modifications to the script, including adding another local script in the StarterGUI, specifically to make sure that the GUI fires ONLY when the player joins the server, shown below.

game.Players.PlayerAdded:connect(function(plr)
    local startup = game.ReplicatedStorage.GUIs.startupScreen:Clone()
    startup.Parent = plr.PlayerGui
end)

Also, the GUI works as so. The GUI goes from invisible to visible using the transparency property in the GUI. I set it to trigger whenever the PlayerGUI is the GUI's parent. (Basically the GUI is in the player) However, when I join the game, it doesn't move to the playerGUI parent.

Here's the transparency script within the GUI if this would help any.

local player = game.Players.LocalPlayer
local parent = player.PlayerGui

if not parent then
    wait()
else
    for i = 1,0.5, -.01 do
        script.Parent.BackgroundTransparency = i    
        wait(.1)
    end
end

Thanks in advance.

0
You destroy the GUI after the use, right? Kyokamii 133 — 9y
0
Yep konichiwah1337 233 — 9y

3 answers

Log in to vote
1
Answered by 9 years ago

From what I can see, the problem lies in the script that controls the transparency. For the if not then function, your use of the variable "parent" would show up in the script like this, if it was not a variable.

if not game.Players.LocalPlayer.PlayerGui then
-- etc.

That does not tell the game what it is looking for. How I, personally would script that statement is

if not script.Parent == game.Players.LocalPlayer.PlayerGui  then -- Change parents to fit your needs.
-- etc.

because that tells the script you aren't looking for if PlayerGui Exists, but if your GUI's Parent is PlayerGui.

Also, Make sure you are using a LocalScript to run this.

0
Thank you! konichiwah1337 233 — 9y
Ad
Log in to vote
0
Answered by 9 years ago
local player = game.Players.LocalPlayer
local parent = player.PlayerGui
game.workspace:FindFirstChild("Humanoid")
while true do
if humanoid and humanoid.Health == 0 then 
local parent = game.StarterGui
    end
end

try this tell me if it works or not

Log in to vote
0
Answered by 9 years ago

@Munter6000

Similar to what I needed, but not what I needed at the same time (by far.)

Answer this question