I’m gonna keep this brief because I am genuinely stumped on this
I am working on a script that allows players to morph into any NPC they click on. the client fires a remoteevent to the server to morph the player, and the server fires a remoteevent back after to change the camerasubject to the new character.
the morphing part works fine, but no matter what I try, the event does not fire back at the client.
for clarification:
- the RemoteEvent is in ReplicatedStorage
- I have tried putting a print call after the FireClient in the server script and it prints like normal
- I have tried putting a print call in the client script and it still doesn’t work
- I have tried triggering the RemoteEvent in a different server script and it works properly, so the issue is in the server script
- no errors are in the output
server script:
RemoteEvents.MorphCharacter.OnServerEvent:Connect(function(plr, HitObject)
if HitObject.Parent.Parent == workspace.Characters.NPC and plr.Role.Value == "Hider" then
local Character = HitObject.Parent
local customCharacter = Character:Clone()
local oldPosition = plr.Character.HumanoidRootPart.CFrame
customCharacter.Name = plr.Name
customCharacter.Parent = workspace.Characters.Player
customCharacter.HumanoidRootPart.CFrame = oldPosition
if plr.Character then
plr.Character:Destroy()
end
plr.Character = customCharacter
if plr then
RemoteEvents.ChangeCamSubject:FireClient(plr, customCharacter)
print("test") --this part does print properly
end
end
end)
client script:
RemoteEvents.ChangeCamSubject.OnClientEvent:Connect(function(subject)
workspace.CurrentCamera.CameraSubject = subject
end)