How to make working gun in studio lite roblox

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ธ.ค. 2024

ความคิดเห็น • 6

  • @YourTrollKing
    @YourTrollKing 26 วันที่ผ่านมา +2

    How to make a part that gives cash

    • @StudioRobloxprojek
      @StudioRobloxprojek 10 วันที่ผ่านมา +1

      I can make comment my yutube

    • @YourTrollKing
      @YourTrollKing 10 วันที่ผ่านมา

      @StudioRobloxprojek u can make ight

  • @QuadrioFamily-pd2wr
    @QuadrioFamily-pd2wr  26 วันที่ผ่านมา +2

    Comment a totorial idea 💡 and I'll pin you

    • @VivianDaCheetah
      @VivianDaCheetah 24 วันที่ผ่านมา

      tutorial on a working swing pls?!❤

  • @GauthamDevagarchannel
    @GauthamDevagarchannel 24 วันที่ผ่านมา +2

    Description
    How to make working gun in studio lite roblox
    Bacon_boy
    7
    Likes
    133
    Views
    Nov 25
    2024
    Script 👇put in tool 🔫
    local tool = script.Parent
    local handle = tool:WaitForChild("Handle") -- The part of the tool that is held by the player
    local rocketSpeed = 100 -- The speed at which the rocket travels
    local rocketDamage = 50 -- The damage dealt when the rocket hits a player
    -- Function to create and fire the rocket
    local function fireRocket()
    local character = tool.Parent -- The character using the tool
    local humanoidRootPart = character:FindFirstChild("HumanoidRootPart")
    if not humanoidRootPart then return end
    -- Create the rocket part
    local rocket = Instance.new("Part")
    rocket.Size = Vector3.new(1, 1, 3) -- Change this to the size of your rocket
    rocket.Shape = Enum.PartType.Cylinder
    rocket.Color = Color3.fromRGB(255, 0, 0) -- Red color for the rocket
    rocket.Position = handle.Position + (handle.CFrame.LookVector * 2) -- Spawn the rocket just in front of the tool
    rocket.Anchored = false
    rocket.CanCollide = true
    rocket.Parent = workspace
    -- Make the rocket move in the direction the tool is pointing
    local bodyVelocity = Instance.new("BodyVelocity")
    bodyVelocity.MaxForce = Vector3.new(100000, 100000, 100000) -- Max force to move the rocket
    bodyVelocity.Velocity = handle.CFrame.LookVector * rocketSpeed -- Direction and speed
    bodyVelocity.Parent = rocket
    -- Rocket hit detection
    rocket.Touched:Connect(function(hit)
    local otherCharacter = hit.Parent
    local humanoid = otherCharacter:FindFirstChild("Humanoid")
    if humanoid and otherCharacter ~= character then
    -- Damage the player
    humanoid:TakeDamage(rocketDamage)
    -- Destroy the rocket
    rocket:Destroy()
    end
    end)
    -- Destroy the rocket after a few seconds if it doesn't hit anything
    game:GetService("Debris"):AddItem(rocket, 5)
    end
    -- When the player clicks, fire the rocket
    tool.Activated:Connect(fireRocket