Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
Oficcer_F 207 Moderation Voter
5 years ago
Edited 5 years ago

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)

0
mouse is deprecated use userInputService aazkao 787 — 5y
0
It is not. Can you help me with my question? Oficcer_F 207 — 5y
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 User#20388 0 — 5y
0
I still get the same error. Oficcer_F 207 — 5y
1
OnServerEvent() always has the first argument the player who fired the server. It should be script.ExplosionCreate.OnServerEvent:Connect(function(player, explosionPoint, tool) Francisl4d45 7 — 5y

1 answer

Log in to vote
2
Answered by
aazkao 787 Moderation Voter
5 years ago
Edited 5 years ago

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)

0
Oh! Thanks man! Oficcer_F 207 — 5y
0
no prob aazkao 787 — 5y
Ad

Answer this question