Image button doesn't teleport player when clicked on

The 1st script circled in blue is:

local player = game.Players.LocalPlayer
local character = player.Character
local obbiesFolder = game.Workspace.Obbies
local imageButton = script.Parent
local background = game.StarterGui.ScreenGui.Background
local currentcamera = game.Workspace.CurrentCamera
local SettingsButton = game.StarterGui.ScreenGui.SettingsButton

imageButton.MouseButton1Click:Connect(function()
	for _, button in pairs(imageButton.Parent) do
		button.Visible = false
	end
	background.Visible = false 
	wait(0.5)
	character.HumanoidRootPart.CFrame = obbiesFolder.obby1.CFrame + Vector3.new(0, 5, 0)
	currentcamera.CFrame = character.Head.CFrame
	currentcamera.FieldOfView = 70
	currentcamera.CameraType = Enum.CameraType.Custom
	SettingsButton.Visible = true
end)
1 Like

sending prayers, best of luck :pray:

1 Like

Hahaha thank you for your help anyway. @happle5222 Thank you too for the tips.

But also just wondering could it be fixed like this:

1 Like

I’m not 100 percent sure what’s happening, but I’ll leave my final comment in this thread.

The script appears to be working, since it is showing visible, it seems to be a problem with the UI.

Best of luck,
Happle

2 Likes