I was creating a script that spawns a specific part with code from the ServerStorage when i press E. However, i can't figure out what to do next. Here is the entire code:
local pillar = game.ServerStorage.pillarthing pillarclone = pillar:Clone() pillarclone.Parent = workspace local player = game.Players.LocalPlayer local character = player.Character pillarclone.Position = character function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.E then end end game:GetService("UserInputService").InputBegan:connect(onKeyPress)
local pillar = game.ServerStorage.pillarthing local player = game.Players.LocalPlayer local character = player.Character function onKeyPress(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.E then pillarclone = pillar:Clone() pillarclone.Parent = workspace pillarclone.CFrame = character:FindFirstChild("HumanoidRootPart").CFrame end end game:GetService("UserInputService").InputBegan:Connect(onKeyPress)
That goes inside the StarterGui and local script, use :Connect() instead of :connect() because :connect() is deprecated.
If this worked please mark this question as answered, or accept answer.