FenixFrog
(FenixFrog)
September 4, 2021, 11:42pm
1
So I am trying to make a :stage command but this script isn’t working.
local Camera
local CameraPart = game.Workspace.Stage.CameraPart
game.PlayersPlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(Char)
end)
player.Chatted:Connect(function(Message)
if Message = “:stage” then
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CameraSubject = CameraPart
end
end)
end)
So I need help fixing it.
LMVM2041
(LMVM2041)
September 4, 2021, 11:44pm
2
What is the error that pops up?
LMVM2041
(LMVM2041)
September 4, 2021, 11:45pm
3
FenixFrog:
local Camera
And also, if this is a typo, make it:
local Camera = game.Workspace.CurrentCamera
FenixFrog
(FenixFrog)
September 4, 2021, 11:45pm
4
There is no error. That showed in the Output.
Is this done on a localscript or server?
FenixFrog
(FenixFrog)
September 4, 2021, 11:46pm
6
Yea it’s a typo. I meant to put that.
FenixFrog
(FenixFrog)
September 4, 2021, 11:46pm
7
It is a server script in server script service.
LMVM2041
(LMVM2041)
September 4, 2021, 11:47pm
8
Technically, you could set the CFrame of the camera instead of CameraSubject. Try:
Camera.CFrame = CameraPart.CFrame
Remember to make the part face forwards because the camera always places itself forwards.
You will have to fire a remote event to the client to change the camera as the server cannot change the perspective of a player.
1 Like
FenixFrog
(FenixFrog)
September 4, 2021, 11:58pm
10
So like this?:
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
Player.Chatted:Connect(function(Message)
if Message == ":stage" then
game:GetService("ReplicatedStorage").Chatted:FireClient()
end
end)
end)
end)
Yes but ensure you are passing the player through the remote:
game:GetService("ReplicatedStorage").Chatted:FireClient(Player)
FenixFrog
(FenixFrog)
September 5, 2021, 12:02am
12
Alright, it works! Thanks! (This is for the thirty letters.)
1 Like