So, I made a game, and I wanna know how to make it so everyone which touches it but the player generating it gets hurt. This is the only issue I have before the attack is finalized. I believe the issue is in the part creation script.
Main script part:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("forcebrr")
RemoteEvent.OnServerEvent:Connect(function(player)
local part = game.ServerStorage.ForceField:Clone()
part.Parent = workspace
part.Position = player.Character.Torso.Position
part.CanCollide = false
part.Anchored = true
part.Touched:Connect(function(hit)
local char = player.Character
local humanoid = char.Humanoid
hit.Humanoid:TakeDamage(20)
end)
All other parts are just me making it smoother and resizing it.

3 comments
While it works, it also damages and insta kills the player who created it (Aka the player who pressed R.) Can you fix that?
yeah !
added some changes