Hi, I am making an invincibility potion for my game that prevents the player from getting damage using the force field but I have no idea how to parent the forcefield to the character in a server script. This is my script.
local tool = script.Parent local char = --How to define the character?-- tool.Activated:Connect(function() local FF = Instance.new("ForceField", char) wait(5) FF:Destroy() end)
Please help me.
It's safe to assume that Tool.Parent
refers to the Character Model when Equipped, therefore, it's best to allocate the avatar accordingly:
local Tool = script.Parent Tool.Equipped:Connect(function() Character = Tool.Parent end) Tool.Activated:Connect(function() print(Character.Name.." used the Tool!") end)