I am trying to use a RemoteFunction to send an object to a player's camera. I understand a basic localscript with FilteringEnabled will do this trick, but the problem is, the object is something the player needs to pick up and obtain - not just be "seen". I tried this and the object to be picked up doesn't register.
So with that being said, I've been trying to send an object to a player's camera for the purpose so that only THEY can see the object and can interact with it and data actually saves, through a RemoteFunction.
Is there a better method rather than sending this to the player's camera?
Here is my failed script attempt:
game.ReplicatedStorage.rings.rings1.OnServerEvent:Connect(function(plrWhoFiredEvent) game.Lighting.rings:Clone().Parent = plrWhoFiredEvent.Camera wait(210) workspace.Camera.rings:Remove() end)
I get the error "Camera is not a valid member of Player".
Thank you very much!
Hey callmehbob,
---- LOCAL SCRIPT WHERE THE REMOTE EVENT FUNCTION HAPPENS ---- local rs = game:GetService("ReplicatedStorage") local event = rs:WaitForChild("PickUp"); event.OnClientEvent:Connect(function(part) local cam = workspace.CurrentCamera; part.Parent = cam; end)
---- SERVER SCRIPT WHERE THE REMOTE EVENT FUNCTION IS TRIGGERED ---- local part = script.Parent; local plrs = game:GetService("Players"); local rs = game:GetService("ReplicatedStorage") local event = rs:WaitForChild("PickUp"); part.Touched:Connect(function(obj) local hum = obj.Parent:FindFirstChild("Humanoid"); if hum then local char = obj.Parent; local plr = plrs:GetPlayerFromCharacter(char); event:FireClient(plr, part); end end)
~~ KingLoneCat