MetaAxis
(MetaAxis)
March 27, 2020, 10:37pm
#1
Hi. Glad to see you here. I made this script that when the player died, it would call a RemoteEvent
.
game:GetService('Players').PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
character:WaitForChild('Humanoid').Died:connect(function()
game.ReplicatedStorage.DeathFunc:FireClient(player)
end)
end)
end)
Then the LocalScript
picks up the RemoteEvent
and starts to function.
game.ReplicatedStorage.DeathFunc.OnClientEvent:Connect(function()
repeat wait()
cam.CameraType = Enum.CameraType.Custom
until cam.CameraType == Enum.CameraType.Custom
end)
There are no errors. The function is in ReplicatedStorage
. If you have any questions message below and if I forgot something message me!
1 Like
Leigh_ton
(leighton)
March 27, 2020, 10:40pm
#2
what is the issue? 30 character
2 Likes
You say âfunctionâ is DeathFunc a RemoteFunction or RemoteEvent?
Because there are different ways to fire these events, along with different ways to connect to the event.
1 Like
MetaAxis
(MetaAxis)
March 27, 2020, 10:43pm
#4
When the player is viewing a camera then resets, the camera just âfloatsâ in the air. I might show a video.
1 Like
MetaAxis
(MetaAxis)
March 27, 2020, 10:44pm
#5
I mean the âfunctionâ as a RemoteEvent. Sorry for saying it wrong above
bt5191
(btt)
March 27, 2020, 10:44pm
#6
Functions have OnServerInvoke/OnClientInvoke and use InvokeServer/InvokeClient.
You might want to change what you said youâd call a RemoteFunction to RemoteEvent.
See the message right above yours, he just corrected himself and stated that he said the wrong remote type above.
So, youâre setting the camera type, back to Custom, but are you setting the Camera Subject back to the Humanoid?
1 Like
MetaAxis
(MetaAxis)
March 27, 2020, 10:47pm
#9
MetaAxis
(MetaAxis)
March 27, 2020, 10:48pm
#10
I didnât say anything about the camera subject.
Setting the CameraSubject back to the playerâs Humanoid should fix the problem.
1 Like
MetaAxis
(MetaAxis)
March 27, 2020, 10:49pm
#12
But how should I write it? I never used CameraSubject before.
game.ReplicatedStorage.DeathFunc.OnClientEvent:Connect(function()
repeat wait()
cam.CameraType = Enum.CameraType.Custom
until cam.CameraType == Enum.CameraType.Custom
local character = player.Character or player.CharacterAdded:Wait() --Assuming that player is your LocalPlayer variable name
cam.CameraSubject = character:WaitForChild("Humanoid")
end)
2 Likes