Sup,
I was thinking about something and wondered if this is possible. I planned on making a .touched event fire a event, goes to a local script, and the local script fires a event with the camera cframe and another server script receives it. Before I try this, I was wondering if this is possible or if there is a easier way of doing this? Reason I need to do this is I plan on data saving the cframe value for my fixed camera system. I don’t need any scripts written or anything, just wondering if this is actually possible.
I do know that the Camera is souly on the client and only the client, passing arguments to the server of the Camera’s CFrame is possible I believe.
So is it possible I could send the camera’s CFrame value via a event through the client to the server?
I believe it is, it’s worth trying, I don’t see what would be stopping it.
Like for example, if you’re just having the server fire all clients checking their (the clients) Camera’s CFrame, and if it’s set, to then run something on the client or the server.
Someone may have a better understanding though, or a guaranteed answer.
Alright thanks, since its pretty late where I am at ill test it out in some hours and get back to you on my findings!
Alright, late for me too, but I’ll be sure to be looking out for a response.
Well uh, I tried but it didn’t work no error’s. Here’s the part touched script:
script.Parent.Touched:Connect(function()
game.ReplicatedStorage.RemoteEvent:FireAllClients()
end)
Local script recieving:
local player = game.Players.LocalPlayer
repeat wait() until player.Character
local camera = workspace.CurrentCamera.CFrame
local camtype = Enum.CameraType.Scriptable
game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
game.ReplicatedStorage.rev:FireServer(camera)
end)
Other server script:
game.ReplicatedStorage.rev.OnServerEvent:Connect(function(camera)
camera = workspace.cam.CFrame
end)
Sorry I completely forgot about this, forgive me.
This is a very difficult subject by the way, I’ve seen people struggle with this simply because the camera is souly on the client and we’re trying to manipulate it with the server, which you’d think is fairly easy.
I have had this issue before. However, trying to replicate it now, it seems to work.
-- Client test script
while task.wait() do
game.ReplicatedStorage.RemoteEvent:FireServer(workspace.CurrentCamera.CFrame)
end
-- Server test script
game.ReplicatedStorage.RemoteEvent.OnServerEvent:Connect(function(plr, val)
print(plr.name .. ": " .. tostring(val))
end)
I should’ve mentioned this in my previous reply, however I missed this then.
But using wait() should be avoided if possible. Luckily for you there are alternatives.
For example:
player.CharacterAdded:Connect(function()
-- Do whatever you need the char for. Works even if player dies.
end)
or
workspace:WaitForChild(player.Name)