Origin in not a valid member of Player "Players.Lamino961

Hello, I encountered such a problem but I don’t know how to fix it. I spent a lot of time and didn’t find a solution either on the forum or on YouTube or in Google. Any help is appreciated. I don’t know how to fix it. Help!

local Debris = game:GetService("Debris")
local repStorage = game:GetService("ReplicatedStorage")
local TakeDamage = repStorage.FireTakeDamage

local function newPart(name, parent, nidPoint, start, ray, pos, color)
	local part = Instance.new("Part", parent)
	part.Anchored = true
	part.CanCollide = false
	part.Name = name
	if pos then
		part.CFrame = pos
		part.Transparency = 1
	else
		part.CFrame = CFrame.new(nidPoint, start)
		part.Size = Vector3.new(1,1, ray.Direction.Magnitude)
		part.Transparency = 0.5
		part.Material = Enum.Material.SmoothPlastic
		part.Color = color
	end

	return part
end

local function newBeam(parent, start, endPart, curve)
	local att0 = Instance.new("Attachment", start)
	local att1 = Instance.new("Attachment", endPart)
	local beam = Instance.new("Beam", parent)
	beam.Attachment0 = att0
	beam.Attachment1 = att1
	beam.CurveSize0 = curve

	return beam
end

local function soulHarvest(player, ray, hit)
	local char = player.Character
	local rayEnd = ray.Origin + ray.Direction
	local rayStart = ray.Origin
	if hit then
		local hitChar
		if hit.Parent:IsA("Accessory") then
			hitChar = hit.Parent.Parent
		else
			hitChar = hit.Parent
		end

		if hitChar and hitChar:FindFirstChild("Humanoid") then
			local endPart = newPart("end", game.Workspace, rayEnd / 2, rayStart, ray, hitChar.Head.CFrame, Color3.fromRGB(255, 255, 255))
			local startPart = newPart("start", game.Workspace, rayEnd / 2, rayStart, ray, char.Head.CFrame, Color3.fromRGB(255, 255, 255))
			local beam1 = newBeam(game.Workspace, startPart, endPart, 3)
			local beam2 = newBeam(game.Workspace, startPart, endPart, -3)

			hitChar.Humanoid:TakeDamage(player.Psp.Value)
			Debris:AddItem(endPart, 1)
			Debris:AddItem(startPart, 1)
			Debris:AddItem(beam1, 1)
			Debris:AddItem(beam2, 1)
		end
	end
end


repStorage.SoulHarvest.OnServerEvent:Connect(soulHarvest)
2 Likes

The problem is in this script All the time it points to this

1 Like

Your problem is with your LocalScript calling :FireServer(), by any chance are you passing the Player as an argument?

E.g. :FireServer(Player, Ray, Hit)?

2 Likes

Yes, that’s exactly how I use it game:Get service(“ReplicatedStorage”). SoulHarvest: FireServer(player,ray,hit)

That’ll be your problem. When using FireServer, you don’t need to pass the Player. The event automatically passes the player who fired it:

-- Local Script:
Event:FireServer(Ray, Hit)

-- Server Script:
Event.OnServerEvent:Connect(function(Player, Ray, Hit)

end)
1 Like

It’s passing the ‘Player’ twice, which means your ‘ray’ parameter in the soulHarvest function is actually the Player.

If you read the comments of that video it seems everyone else was having the same problem as you.

1 Like

Now it doesn’t give me an error, thank you

1 Like

No worries, glad I could help.

I have the following problem, I don’t know how to say it, it’s even global, can you help me, don’t consider it impudence

Explain the problem and I can try to help.

I have 1 script to counter a blow from a player it could be EnergyFist and EnergyPucnh and SoulHarvest But the problem is that when I shoot or hit a player, he doesn’t die, but he should. I’ll send you the script now.

deleted by user for fixing problem script

deleted by user for fixing problem script

I don’t understand what the problem is, I think it’s because of the script protection

I wrote the script myself and I don’t know how to fix it and I don’t understand why this is happening and no one can help me, I decided to give you this problem

Any errors, anything being printed?

I’d recommend starting with a single “ability” and trying to get that working. If none of them are then there’s a decent chance fixing one of them will fix the rest.

Place lots of prints throughout the code and see where it’s getting held up. It’s a lot of code to try to debug from sight.

1 Like

Okay, I’ll do what you said And the error is not displayed unfortunately