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

Every time i click the play button on my menu its supposed to Make the gui visible but it wont?

Asked by 3 years ago

Every time i click the play button on my menu its supposed to Make the gui visible but it wont?

local btn = script.Parent -- we get the button
local remote = game:GetService("ReplicatedStorage"):WaitForChild("Menu") -- we get the remote event
local camera = workspace.CurrentCamera -- we get the camera
local character = workspace:WaitForChild(game.Players.LocalPlayer.Name) -- we get the player's character

btn.MouseButton1Click:Connect(function() -- we do stuff under it once the button was pressed
    script.Parent.Parent.Visible = false --  we will make the frame invisible
    remote:FireServer("Menu") -- we will fireserver the remote event
    if game.Players.LocalPlayer:WaitForChild("Data").HasGame.Value == true then -- if the player has existing data and only needs to be teleported to the island then...
        -- we will turn the camera back to normal
        camera.CameraType = "Custom" -- we set the camera type to custom
        camera.CameraSubject = character.Humanoid -- we set the camera subject to the character's humanoid
        camera.CFrame = character.Head.CFrame -- we set the camera's cframe to the character's head's cframe
        script.Parent.Parent.Parent.Parent.Guis.Bars.Visible = true -- we make the bars frame in the gui go visible
        script.Parent.Parent.Parent.Parent.Guis.menuBtn.Visible = true -- we make the menu button in the gui go visible
        script.Parent.Parent.Parent.Parent.Guis.saveBtn.Visible = true -- we make the save button in the gui go visible
        script.Parent.Parent.Parent.Parent.Guis.beli.Visible = true -- we make the beli text in the gui go visible
    end
end)
0
What is this: script.Parent.Parent.Parent.Parent? Why do this. Why not allocate variables. Why make the script so deep?? Ziffixture 6913 — 3y
0
camera.CameraType = "Custom" - Enum.CameraType.Custom*** Ziffixture 6913 — 3y
0
workspace:WaitForChild(game.Players.LocalPlayer.Name). There is literally a pointer to their Character Rig: Player.Character Ziffixture 6913 — 3y

Answer this question