local player = game.Players.LocalPlayer
local userInputService = game:GetService("UserInputService")
-- Configuration
local ITEM_ID = 64
local STACK_SIZE = 64
local SPAWN_KEY = Enum.KeyCode.G
-- Function to spawn a single item
local function spawnItem()
local character = player.Character or player.CharacterAdded:Wait()
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
-- Create a new item
local item = Instance.new("Part")
item.Name = "SpawnedItem"
item.Size = Vector3.new(1, 1, 1)
item.BrickColor = BrickColor.new("Bright yellow") -- Color for Netherite Scrap
item.CanCollide = true
item.Anchored = false
-- Set position in front of the player
item.CFrame = humanoidRootPart.CFrame * CFrame.new(0, 0, -2)
-- Add physics
local velocity = Instance.new("BodyVelocity")
velocity.Velocity = humanoidRootPart.CFrame.lookVector * 10
velocity.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
velocity.Parent = item
item.Parent = workspace
end
-- Function to spawn a full stack
local function spawnStack()
for i = 1, STACK_SIZE do
spawnItem()
end
end
-- Listen for key press to spawn items
userInputService.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard and input.KeyCode == SPAWN_KEY then
spawnStack()
end
end)
Comments
No comments yet
Be the first to share your thoughts!