local actorPath = "/Game/Path/To/YourWeapon.YourWeapon_C"
RegisterKeyBind(Key.M, function()
ExecuteInGameThread(function()
LoadAsset(actorPath)
local playerLocation = UEHelpers.GetPlayerController():K2_GetPawn():K2_GetActorLocation()
local spawnLoc = {
X = playerLocation.X + 200.0,
Y = playerLocation.Y,
Z = playerLocation.Z
}
local ActorClass = StaticFindObject(actorPath)
if ActorClass and ActorClass:IsValid() then
local Actor = UEHelpers.GetWorld():SpawnActor(ActorClass, spawnLoc, { Pitch = 0.0, Yaw = 0.0, Roll = 0.0 })
if Actor and Actor:IsValid() then
print("Actor spawned: " .. Actor:GetFullName())
end
else
print("Failed to find actor class: " .. actorPath)
end
end)
end)
Try making a UE4SS mod and pasting this code, though ypu do need to replace the actor path to an actuall weapon using fmodel to get the path and you also put at the end of the path where is the name of the weapon your put .WeaponName_C
You spawn the weapon by pressing M