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

My GUI's Frame Isn't Appearing After The Camera Changes!?

I'm Trying To Make This Code Where When The Camera Changes the Frame Of The gui (local shop) Appears, But It Isn't, why?

LocalScript In StarterPlayerScripts

local present = game.ReplicatedStorage.PresentModel
local shop = game.StarterGui:WaitForChild("Shop")

workspace.Part.ClickDetector.MouseClick:connect(function()
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera

repeat wait()
   Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable
Camera.CFrame = workspace.CameraSpawns.CameraPart.CFrame
print("Changed")
local localpresent = present:Clone()
localpresent.Parent = workspace
shop.Enabled = true
end)

1 answer

✓ Accepted answer

On line 2, you use StarterGui. This will not work as StarterGui only copies into your player's PlayerGui when you respawn or join the game.

Use your own player's PlayerGui, as it is guaranteed to show the changes you make.

local present = game.ReplicatedStorage.PresentModel
local shop = game.Players.LocalPlayer.PlayerGui:WaitForChild("Shop")

workspace.Part.ClickDetector.MouseClick:connect(function()
	local Player = game.Players.LocalPlayer
	local Character = Player.Character or Player.CharacterAdded:Wait()
	local Camera = workspace.CurrentCamera

	repeat 
		wait()
		Camera.CameraType = Enum.CameraType.Scriptable
	until Camera.CameraType == Enum.CameraType.Scriptable
	
	Camera.CFrame = workspace.CameraSpawns.CameraPart.CFrame
	print("Changed")
	local localpresent = present:Clone()
	localpresent.Parent = workspace
	shop.Enabled = true
end)

1 comment

0

Thank You Very Much!

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