Getting weird errors?

So currently I’m trying to make special skills for my combat system in my game, and for some reason the script works, but doesn’t at the same time, I know this might sound weird but its true i promise you! Alright so here’s the weird errors that I am getting

But here is proof that the script actually works
https://gyazo.com/a8e05cdd182fd3af1a7821836b991822

I’ve made it using a local script that is inside the tool that sends to the server script the enemy player, their humanoid root part and their humanoid using a remote, here is a chunk of the local script


UIS.InputBegan:Connect(function(input,gameprocessed)
		if input.KeyCode == Enum.KeyCode.X  and active == true then
		--	if debounce2 == true then
			--	return
		--	end
		if debounce2 == false then
			debounce2 = true
				local Players = game:GetService('Players')

				for _,Player in next, Players:GetChildren() do
					local character = Player.Character
					if character and character.Parent and Player ~= player then
						local eHumRP = character.HumanoidRootPart
						local eHum = character.Humanoid
						local eChar = character
						local Magnitude = (player.Character.HumanoidRootPart.Position - character.HumanoidRootPart.Position).magnitude
						local Humrp = char:FindFirstChild('HumanoidRootPart')
						if Magnitude <= 10 then
							smashEvent:FireServer(char, eHum, eHumRP, eChar)
						end
					else
						smashEvent:FireServer(char)
					end
				end
			end
		end
	end)
end)

and here is the the server side script



local RP = game:GetService('ReplicatedStorage')

local Smash = RP.CombatRemote:WaitForChild('Smash')
local Heavy = RP.CombatRemote:WaitForChild('Heavy')

		
Heavy.OnServerEvent:Connect(function(Player,Char, eHum, eHumRP, eChar)
	local Humrp = Char:FindFirstChild('HumanoidRootPart')
	local Hum = Char:FindFirstChild('Humanoid')
	
end)

Smash.OnServerEvent:Connect(function(Player,Char, eHum, eHumRP, eChar)
	local Humrp = Char:FindFirstChild('HumanoidRootPart')
	local Hum = Char:FindFirstChild('Humanoid')
	
	eHumRP.CFrame = eHumRP.CFrame * CFrame.new(0,2,0)
	eHum:TakeDamage(10)

end)

Please someone help me with this problem because I have no idea what i’m supposed to do in order to fix it

Likely this, your smash events expects eHumRP to be given, but you only give Char. I don’t know why you fire the Smash event with only the character if it expects more than that, what is it supposed to do?

it only does that if it doesnt detect another player within 10 studs radius, you can see that it has a

else
	smashEvent:FireServer(char)

Yes, but the thing is, in your OnServerEvent for that event, it does this

eHumRP.CFrame = eHumRP.CFrame * CFrame.new(0,2,0)

You didn’t specify a eHumRP in that FireServer, so it’s going to error, I don’t think you need to fire it in the case that there’s no character nearby

yes i did

				local eHumRP = character.HumanoidRootPart
						local eHum = character.Humanoid
						local eChar = character

it specifies the enemie’s hum, humrp when it searches for players around, you can also see in the gyazo that the scipt works at first but it gives errors about the CFrame

Those are local in the other condition you have

if character and character.Parent and Player ~= player then

You only specify them in the event it finds a nearby character, but if it didn’t, there’s no specification and thus it’ll fire without the parameters the event needs

im still confused to whats really wrong with the script…

Why do you evne need

smashEvent:FireServer(char)

When it’s going to always error cause you’re not specifying what it needs, just remove it and the else

2 Likes

okay, ill do that and hopefully magically it will work

Okay, thanks am not gonna do a else check from now on :skull:

1 Like