Ok so I want a player to press a text button then the Camera subjects to the character changes i have been trying to do this for a while but i am a bit confused, i am still really a beginner
It’s a client to server remote event
local script
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("re")
local click = script.Parent.ScreenGui.TextButton
remoteEvent:FireServer(click)
Script which is just in workspace
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("re")
local function One(player,click)
local click = player.PlayerGui.ScreenGui.TextButton
click.MouseButton1Click:Connect(function()
local character = player.Character
local important = character.HumanoidRootPart
workspace.CurrentCamera.CameraSubject = important
-- Fire the remote event
end)
end
remoteEvent.OnServerEvent:Connect(One)
So in order to be able to help we need some view of the output you see on the console and to do that can you put some prints in to confirm the process flow and values of any variables that m ay effect that flow.
You’re trying to change the Client camera from the server. Which is most likely the issue. You have to change the client camera from a local script. Also, your code seems to be all over the place where you randomly fire an event with the Object script.Parent.ScreenGui.TextButton
-- put this script in a local script --
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local remoteEvent = ReplicatedStorage:WaitForChild("re")
local player = game.Players.LocalPlayer
local click = player.PlayerGui.ScreenGui.TextButton
click.MouseButton1Click:Connect(function()
local character = player.Character
local important = character.Humanoid
workspace.CurrentCamera.CameraSubject = important
-- Fire the remote event
end)