So I'm trying to make a script personally for me just for scripting practice. Then I realized this would make as a really good game. There aren't any errors in the output at all, and I have checked the wiki about 20 times. So please help.
local player = game.Players.LocalPlayer.Character local UserInputService = game:GetService("UserInputService") while wait(0.2) do function onInputBegan(inputObject, gameProcessedEvent) if inputObject.KeyCode == Enum.KeyCode.F then local ball = Instance.new("Part", workspace) ball.Parent = player.Torso ball.BrickColor = BrickColor.new("Teal") ball.Material = "Plastic" ball.Transparency = .6 local Weld = Instance.new("Weld", ball) Weld.Part0 = ball Weld.Part1 = player.Torso ball.CFrame = player.Head.CFrame Weld.C0 = ball.CFrame:inverse() Weld.C1 = player.Torso.CFrame:inverse() ball.Anchored = false wait(1) ball:Destroy() Weld:Destroy() end end end UserInputService.InputBegan:connect(onInputBegan)
You have the function in an infinite loop. Not only is this super inefficient, it will keep your code from working.
Why?
Line 28, where you connect the function to an event, never actually runs. The script stays in the while loop for eternity, and never reads that line.
Just get rid of the while loop and you'll be getting somewhere.