How can I apply the attributes retrieves from a :GetAttribute variable

This is my code

function shoot()
	local ammo = script.Parent.Parent.Dart:GetAttributes()
	local explode = Instance.new("Explosion")
	explode.Parent = game.Workspace
	explode.Position = script.Parent.Position
	explode.BlastPressure = 300000
	explode.DestroyJointRadiusPercent = 0
	local reset = Instance.new("Part")
end

how do I apply ammo to reset

Is this your ammo reset? Because if it is you must specify the parent

I am not really having any problems with the parent or anything, I am just trying to understand how I would apply ammo (a set of attributes) to reset (a new part)

is there a “:GiveAttributes” function or something

:GetAttribute() is used with the argument involving the attribute name, for example:

local ammo = script.Parent.Parent.Dart:GetAttribute("Ammo")

this would return the value of the Ammo attribute

i am using getattributes not getattribute, so idk if it is the same

Oh i see that now, :GetAttributes() returns a table ordered like the following:

{["Ammo"] = 3}

so if you were to use this in a script you could do it as such:

local attributes = script.Parent.Parent.Dart:GetAttributes()
local ammo = attributes["Ammo"]
1 Like