Information:
I’m trying to re-create an orb system for player deaths. Currently, the system works by checking if the humanoid died then if it died it checks for an object value. If they have the object value then, the orb is cloned to the dead player’s root part. The problem with this is that everyone can see the orbs and I want the system to work only the killer can see the orbs created. Right now, I’m checking if the player has a “Creator Tag” which is just an object value containing the player’s name of who is the killer as a value.
The only way I could think to bypass this is to clone the part to the player’s client. My idea was when you die it fires a remote event to speak to the server. Then, the server communicates to the killer’s client. I was wondering if it’s possible to take in the creator tags value and then go to trigger for that player’s client. I haven’t tried anything because my code is working as of right now. I’m just looking for some information that I can go off of.
I looked on the dev forum but couldn’t find much. All I found was communicating from client > server > same client. Not a different client.
Here is my code from Starter Player Scripts (Local Script):
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
local remote = game.ReplicatedStorage.DiedEvent
Humanoid.Died:Connect(function()
remote:FireServer("playerDied")
end)
Server Script Service (Regular Script):
remote2.OnServerEvent:Connect(function(Player)
print("Worked1")
if ("playerDied") then
print("Worked2")
local character = Player.Character
local tag = character.Humanoid:FindFirstChild("creator")
if tag then
print("Worked3")
local debris = game:GetService("Debris")
local players = game:GetService("Players")
local despawnTime = 10
local humanoid = character:WaitForChild("Humanoid")
local root = character:WaitForChild("HumanoidRootPart")
local orb = game.ReplicatedStorage.Orb
local orb1 = orb:Clone()
local orb2 = orb1.Middle
debris:AddItem(orb1, despawnTime)
print("working?")
orb1.CFrame = root.CFrame
orb2.CFrame = root.CFrame
print("working?")
orb1.Parent = workspace.Orbs
orb1.Name = tag.Value
local killer = Instance.new("StringValue")
killer.Parent = orb1
end
end
end)
I just want to figure out how I could communicate back to a different client!
Anything helps. Thanks for reading!