For some reason whenever I fire a remote event with Tuples, it leaves out crucial data on the end, for example, whenever I want the position of the user of a tools head, script.Parent.Parent.Head.Position, it will only go to script.Parent.Parent. Whenever I want the orientation, I don’t even know what it does it just isn’t anywhere near the orientation of the head.
where the RemoteEvent fires from (a localscript in a tool)
You are passing 3 arguments to :FireServer when the listener function is expected 2 arguments only. The Launcher argument actually points to the player object of the client that fired the remote event. Also, if this script is meant to position the AttackPart to the head, just get the head position from the server; no need to open a frontier for exploiters. Though I am not sure what the arguments are for so just leave the above information for reference.
The fixed code would be this.
local function attack(player)
local clone = game:GetService("ServerStorage").AttackPart:Clone()
clone.CFrame = player.Character.Head.CFrame*CFrame.new(0, 0, -2)
clone.Orientation = player.Character.Head.Orientation -- you don't create a new Vector3, just use the head orientation
clone.Parent = game.Workspace
clone.Launcher.Value = player.Name
wait(0.1)
clone:Destroy()
end
Then from the local script just call :FireServer with no arguments
Also uhh just a few nitpicks nothing too big
Don’t use lighting as storage. Lighting never was and never will be intended for storage. Instead, use the proper services intended for this, them being ReplicatedStorage, ServerStorage.
I don’t think there would be a difference between getting the position locally or from the server. The #1 rule of filtering enabled, is quite literally, never trust the client
Just move your part on the client as well as on the server. You can even give network ownership of the part to the client and you might be able to ditch the remote completely.
I still would wish to know why the RemoteEvent is leaving out large amounts of data, when I ask it to print head (which is the head’s position in my script) it prints Johnnyfireball123 so when I ask for it’s position it gives me an error message of ServerScriptService.ProjectileScript:3: bad argument #1 (CFrame expected, got Object)
Don’t give this much trust to the client.
In your game.ReplicatedStorage.AttackEvent.OnServerEvent:Connect(Attack) your first argument is “launcher” but in an event the player always comes first, when you add the player you can get the character from the player and get the head, tool and rotation.
If you’re looking to send something back to the client when this gets fired I recommend using a RemoteFunction instead of an event (you still get player as the first argument).