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)
