When an enemy dies, it is supposed to make a red part get created.
function onDied() redgem = Instance.new("Part",game.Workspace.GemDropStorage) redgem.Size = Vector3.new(1,1,1) redgem.Material = "Neon" redgem.BrickColor = BrickColor.new("Really red") end
when i get a sword, and kill the enemy, the part doesent get created!
the enemy is a working humanoid that moves around
You have created the function but you aren't calling it
To call a function you would do
functionname()
We want to run this function when the character dies so we will use the Died event of humanoid to call it
local character = workspace.Player character:WaitForChild("Humanoid").Died:connect(function() --waitforchild to make sure its there redgem = Instance.new("Part",game.Workspace.GemDropStorage) redgem.Size = Vector3.new(1,1,1) redgem.Material = "Neon" redgem.BrickColor = BrickColor.new("Really red") end)
In this example i merged the function and where you call it together