hello so i was wondering how would you make it so that when a person presses a button it would lock everyone in the games screen in a certain position for a specific amount of time (like maybe 3 minutes?)
ive already made a functioning open and close ui with some other button commands just cant seem to make this one button work
But if you mean camera you can use a remote and fireallclients whenever a person presses said button. Inside of the playerscripts you can place a local script and do the scripting there. Here is an example that I made.
---// Button Script - Put inside of button
local button = script.Parent.ClickDetector -- whatever the path to your button is. That is if its a click detector
local remote = game.ReplicatedStorage.RemoteEvent -- the path to the remote to fire
button.MouseClick:Connect(function()
remote:FireAllClients()
end)
Next is the local script inside of the StarterPlayerScripts
---// Put script inside of StarterPlayerScript
local remote = game.ReplicatedStorage.RemoteEvent -- the path to the remote to fire
remote.OnClientEvent:Connect(function()
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = workspace.position.CFrame
end)
What this would do is that whenever you press the button it changes the currentcamera CFrame to the desired parts CFrame. To reset this you can do
In this case, instead of a remote event, use a bindable event. They are similar to remote events but they use client to client and server to server communication.
Regardless of the method you use to achieve this there is no way to have your client fire for every single client without first going through the server to fire for every single client (player) in the game.
Considering you want this for every single client, you could in theory FireServer from the client, do some anti exploitive checks (ie. is the person actually suppose to have access to the button), and then use the :FireAllClients from the server side. I made something like this awhile ago for a training center and I think I did something along the lines of that. I’d recommend exploring the other options in this post however to find the best option suited for your needs. RemoteFunctions are one option.
Hello, sorry for the delayed response. I’ve made it work, and now I am trying to make the camera face a certain position. I could technically use “camera.Focus = FocusPart.CFrame” however when I try it like that it puts the camera in a different angle and I want it to be the same angle everytime.
i am honestly just doing this because a decent scripter can cost more than 15k. plus ive already scripted the cafe im just working on some features in the training center, ive already scripted most of them, this is just the last one i need to work.