Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

9: bad argument #3 to 'Position' (Vector3 expected, got Object)? [FILTERING ENABLED HELP]

LocalScript (In a tool)

tool = script.Parent
player = game.Players.LocalPlayer


tool.Equipped:Connect(function(mouse)
	mouse.Icon = "http://www.roblox.com/asset/?id=2312592107"
	print("1")
	mouse.Button1Down:Connect(function()
		print(1)
	explosionPoint = mouse.Hit.p
	game.Workspace.ToolExplosion.ExplosionCreate:FireServer(explosionPoint, tool)
	
	
	end)
end)

ServerScript (In workspace)

script.ExplosionCreate.OnServerEvent:Connect(function(explosionPoint, tool)
		local explosion = Instance.new("Explosion")
		explosion.Parent = game.Workspace
		explosion.Position = explosionPoint
		
end)


ERROR ON LINE 4 (SERVER SCRIPT)

5 comments

0

mouse is deprecated use userInputService

0

It is not. Can you help me with my question?

1

game.Workspace.ToolExplosion.ExplosionCreate:FireServer(player, --// Don't add the player, the server knows who is sending it, what you actually receive is player, player, explosionPoint, tool

0

I still get the same error.

1

OnServerEvent() always has the first argument the player who fired the server. It should be script.ExplosionCreate.OnServerEvent:Connect(function(player, explosionPoint, tool)

1 answer

✓ Accepted answer

that is because the first argument of OnServerEvent is always the player object, so yes you will still get the same error because you removed the player argument in your OnServerEvent,and explosionPoint becomes the player argument,Redcommanderv2 is saying that you should remove the player argument from fireServer only

script.ExplosionCreate.OnServerEvent:Connect(function(player, explosionPoint, tool)

2 comments

0

Oh! Thanks man!

0

no prob

This discussion is preserved as it was. New answers, comments, and votes are closed.