Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how could I make an ammo box that fill everyone's ammo ?

Asked by 5 years ago

hi ! I want to make an ammo box that when someone touch it then he will fill up the ammo of everyon but I don't know how to make it I know that in my script the starting is the bad point but I don't know how to fix it......

here is the script:

local player = game.Workspace.LocalPlayer
local character = player.Character
local Crate = script.Parent
local Tool = character:FindFirstChildOfClass("Tool")
local Config = Tool:FindFirstChild("Config")

Crate.Touched:connect(function(Hit)
    if Hit then
        if Tool then
            if Config then  

                local Ammo = Config:FindFirstChild("Ammo")
                local MaxAmmo = Config:FindFirstChild("MaxAmmo")
                local Clips = Config:FindFirstChild("Clips")
                local MaxClips = Config:FindFirstChild("MaxClips")
                if Ammo and MaxAmmo and Clips and MaxClips then
                    --//Replenish Ammo
                    Ammo.Value = MaxAmmo.Value
                    Clips.Value = MaxClips.Value
                end             
            end     
        end
    end
end)

Answer this question