Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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)

11 comments

0

Instead of workspace.Camera use workspace.CurrentCamera

0

Also please provide code

0

I tried workspace.CurrentCamera, the same results.

0

How do people mess up indentation when studio does it for them

0

After setting to "custom" you might also have to set the target

0

And how do i do that?

0

Wait one more thing, is this in script or localscript

0

localscript

0

I got to go, tommorrow i'll review your help to see if it patches anything.

0

Do you have discord

0

Papsterek#2999

2 answers

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)

1 comment

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.

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

4 comments

0

Don't duplicate your questions, that are deleted!

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!

0

Alright,my bad... Thanks for telling me!

0

The thing is, i don't know how to do that.

This discussion is preserved as it was. New answers, comments, and votes are closed.