Hello, so i writed code for whenever player clicks on gui button camera should move to the certain part. but it doesnt work. can anyone tell me why?
local plr = game.Players.LocalPlayer;
local gui = plr.PlayerGui;
local character = plr.Character;
local humanoid = character:WaitForChild("Humanoid");
local landTerraformationButton =gui.ScreenGui:WaitForChild("TerraformButton");
local upButton = gui.ScreenGui:WaitForChild("UpTerraform");
local downButton =gui.ScreenGui:WaitForChild("DownTerraform");
local ts = game:GetService("TweenService")
local rs = game:GetService("RunService")
local plr = game:GetService("Players")
local camera = workspace.CurrentCamera
local truth = true
local oldcamera = camera.CFrame;
landTerraformationButton.MouseButton1Click:Connect(function()
if truth then
print("Stage Alpha1...")
truth = false
camera.CFrame = workspace.Part.CFrame
else
print("Stage Alpha2...")
truth = true;
camera.CFrame = oldcamera;
end
upButton.Visible = not upButton.Visible
downButton.Visible = not downButton.Visible
end)