sharinganRemote.OnServerEvent:Connect(function(player, rayStart, rayDirection)
local character = player.Character
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
local humanoid = character:WaitForChild("Humanoid")
local raycastParams = RaycastParams.new()
raycastParams.FilterType = Enum.RaycastFilterType.Exclude
raycastParams.FilterDescendantsInstances = {character}
local raycastResult = workspace:Raycast(rayStart, rayDirection, raycastParams)
local sharinganVfx = ReplicatedStorage:WaitForChild("Vfx"):WaitForChild("SharinganVfx"):Clone()
sharinganVfx.Parent = workspace.AbilitiesCloned
sharinganVfx.CFrame = character.Head.CFrame * CFrame.new(0, 2, -5)
wait(0.001)
sharinganVfx.Attachment.ParticleEmitter:Emit(1)
print("event")
if raycastResult then
local hitPart = raycastResult.Instance
print(hitPart)
if hitPart.Parent:FindFirstChild("Humanoid") then
local characterEnemy = hitPart.Parent
local humanoidEnemy = characterEnemy:FindFirstChild("Humanoid")
humanoidEnemy.WalkSpeed = 0
local enemyAnimation = ReplicatedStorage:WaitForChild("Animations"):WaitForChild("SharinganEnemyAnimation")
humanoidEnemy:LoadAnimation(enemyAnimation):Play()
humanoidEnemy:TakeDamage(abilitySettings.Abilities[4].damage)
local part = workspace.cameraSharingan
moveCameraToPartEvent:FireClient(characterEnemy)
wait(abilitySettings.Abilities[4].lifeTime)
humanoidEnemy.WalkSpeed = 16
end
end
end)
So this is my script, and at the moment when a player attacks another player the other player (let’s call him the enemy) takes damage. But I also want the enemy to have a camera attached to the desk and he sees the “room” and then the camera goes back to the enemy. But it is necessary that the camera is attached only to the enemy. I tried to make an event, but faced with the problem that I do not know how to attach the camera just at the enemy. Not the player. Can you help me please