Goal
Whenever player clicks some button, its camera should get moved to some location.
Issue
CameraOffset 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");
landTerraformationButton.MouseButton1Click:Connect(function()
game.ReplicatedStorage.LandTerra:Fire(humanoid);
upButton.Visible = not upButton.Visible
downButton.Visible = not downButton.Visible
end)
If you mean like once the button is clicked, making the camera move for like all the people in the server and not just you, im not sure if that is possible.
oh yeah, here is the fixed code for the local script inside of the button too…
local b = script.Parent
local ts = game:GetService("TweenService")
local rs = game:GetService("RunService")
local plr = game:GetService("Players")
local camera = workspace.CurrentCamera
local truth = true
local connectEvent
b.MouseButton1Down:Connect(function()
if truth then
truth = false
local tween = ts:Create(camera, TweenInfo.new(1), {CFrame = workspace.Part.CFrame})
tween:Play()
tween.Completed:Wait()
print("completed")
coroutine.resume(coroutine.create(function()
connectEvent = rs.RenderStepped:Connect(function()
camera.CFrame = workspace.Part.CFrame
end)
end))
end
end)
Oh alright, I understand. I just did a test with two players in studio, and it only affects one player, which is you. So yeah, the tween will only affect the player’s camera separately, it will not affect others.