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

How do i fix GUI not showing up when i respawn and some camera problems?

Asked by 4 years ago
Edited 4 years ago

Hey so i made a main menu test and my friends were experiencing some glitches such as camera glitching out or gui not showing after respawn. Sometimes the Camera is just not on the player after i switch game.Workspace.Camera.CameraType to custom. The main issue i'm experiencing is gui not showing up after death. Just nothing. What it's supposed to show: https://prnt.sc/uq5nr1 Camera glitch: https://prnt.sc/uq5olr The GUI glitch: https://prnt.sc/uq5pqn I wonder if there's any fix to that. I can provide the code i use if you just ask. Also, i put in the console game:GetService("StarterGui").ResetPlayerGuiOnSpawn = true, it didn't work. I made sure the property "ResetOnSpawn" is set to true and i still experience the same issue.

The code:

local camera = game.Workspace.CurrentCamera
local player = game.Players.LocalPlayer



repeat wait(.1) until player.Character.Humanoid.Parent ~= nil

game.Lighting.Blur.Enabled = true

camera.CameraType = "Scriptable"
camera.CFrame = game.Workspace.Camera2.CFrame

player.Character.Humanoid.WalkSpeed = 0
player.Character.Humanoid.JumpPower = 0


script.Parent.Parent.Visible = true

player.Character.HumanoidRootPart.CFrame = game.Workspace.Tel.CFrame

script.Parent.MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false
    repeat
        wait(.05)
        script.Parent.Parent.Parent.dark.BackgroundTransparency = script.Parent.Parent.Parent.dark.BackgroundTransparency - .01
    until script.Parent.Parent.Parent.dark.BackgroundTransparency <= 0
    wait(1)
    game.Lighting.Blur.Enabled = false
    script.Parent.Parent.Parent.dark.BackgroundTransparency = 1

    player.Character.HumanoidRootPart.CFrame = game.Workspace.Tel2.CFrame
    game.Workspace.Camera.CameraType = "Custom"
    player.Character.Humanoid.WalkSpeed = 16
    player.Character.Humanoid.JumpPower = 50
end)

script.Parent.Parent.Customize.MouseButton1Click:Connect(function()
    game.Lighting.Blur.Enabled = false
    script.Parent.Parent.Visible = false
    camera.CFrame = game.Workspace.Camera3.CFrame
    script.Parent.Parent.Parent.Parent.Customize.Frame.Visible = true
    player.Character.HumanoidRootPart.CFrame = game.Workspace.Tel3.CFrame
end)

0
Instead of workspace.Camera use workspace.CurrentCamera User#30567 0 — 4y
0
Also please provide code User#30567 0 — 4y
0
I tried workspace.CurrentCamera, the same results. HamsterxDD 5 — 4y
0
How do people mess up indentation when studio does it for them User#30567 0 — 4y
View all comments (7 more)
0
After setting to "custom" you might also have to set the target User#30567 0 — 4y
0
And how do i do that? HamsterxDD 5 — 4y
0
Wait one more thing, is this in script or localscript User#30567 0 — 4y
0
localscript HamsterxDD 5 — 4y
0
I got to go, tommorrow i'll review your help to see if it patches anything. HamsterxDD 5 — 4y
0
Do you have discord User#30567 0 — 4y
0
Papsterek#2999 HamsterxDD 5 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago
Edited 4 years ago

The GUI may be removing itself because you don't have the ResetOnSpawn property (which is found under the ScreenGui / GuiMain) disabled.

Try enabling it and then see what happens.

I'm not going to leave without giving you code that might help, so here you go.

local CurrentCamera = workspace.CurrentCamera
local LocalPlayer = game:GetService("Players").LocalPlayer

local BlurEffect = game:GetService("Lighting"):FindFirstChild("Blur") or Instance.new("BlurEffect",game:GetService("Lighting"))
BlurEffect.Enabled = true

CurrentCamera.CameraType = Enum.CameraType.Scriptable
CurrentCamera.CFrame = workspace.Camera2.CFrame

LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").WalkSpeed = 0
LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").JumpPower = 0
script.Parent.Parent.Visible = true -- Try using FindFirstAncestor("Name") here.
LocalPlayer.Character:FindFirstChild("HumanoidRootPart").CFrame = workspace["Tel"].CFrame

local DarkFrame = script.Parent.Parent.Parent.dark

script:FindFirstChildWhichIsA("GuiButton").MouseButton1Click:Connect(function()
    script.Parent.Parent.Visible = false -- Try using FindFirstAncestor("Name") here.
    repeat
        wait(.05)
        DarkFrame.BackgroundTransparency = DarkFrame.BackgroundTransparency - .01
    until DarkFrame.BackgroundTransparency <= 0
    BlurEffect.Enabled = false
    DarkFrame.BackgroundTransparency = 1
    LocalPlayer.Character:FindFirstChild("HumanoidRootPart").CFrame = game.Workspace.Tel2.CFrame
    CurrentCamera.CameraType = Enum.CameraType.Custom
    LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").WalkSpeed = 16
    LocalPlayer.Character:FindFirstChildWhichIsA("Humanoid").JumpPower = 50
end)

script.Parent.Parent.Customize.MouseButton1Click:Connect(function()

end)

script.Parent.Parent.Customize.MouseButton1Click:Connect(function()
    BlurEffect.Enabled = false
    script.Parent.Parent.Visible = false -- Try using FindFirstAncestor("Name") here.
    CurrentCamera.CFrame = workspace.Camera3.CFrame
    script.Parent.Parent.Parent.Parent.Customize.Frame.Visible = true -- Try using FindFirstAncestor("Name") here.
    LocalPlayer.Character:FindFirstChild("HumanoidRootPart").CFrame = workspace.Tel3.CFrame
end)

0
I have the ResetOnSpawn property on, i made sure to do that couple of times, i tested with and without it. Your solution didn't really help me and when i put that to the test it broke the thing entirely. What i mean by that is that camera glitches out after you click "Play" and the customize button only shows the gui and doesnt move camera or any of that. I tried fixing and all of that. HamsterxDD 5 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

When answering, if your answer does not fully solve the question, it should be written as a comment to the question instead of as an answer.

For gui not showing up, make sure you have a CharacterAdded Event, and make sure for the camera tht it's set to scriptable.

0
Don't duplicate your questions, that are deleted! JesseSong 3916 — 4y
0
Your answer does not fully address the poster's question - there's no valid explanation (it's not descriptive, neither is their a reference for the poster to refer to, and there's no code). Please make sure you setup a good answer before posting, or your answer will be deleted! JesseSong 3916 — 4y
0
Alright,my bad... Thanks for telling me! Nicholas1088 169 — 4y
0
The thing is, i don't know how to do that. HamsterxDD 5 — 4y

Answer this question