Why Is it still giving me armor even though I made a if statement?

I took your advice and I tried to do it in local functions but i still got purple aura for unique /:







local playerID = {
	58508301,
	15454353, 
	2023345

}


local Module = { }
--(player, player.UserId,  character)
function Module.Aura(player, UserId,Character)
	local replicatedstorage = game:GetService("ReplicatedStorage")
	local aura = replicatedstorage.Aura
	local Aura1 = aura.Aura1Effect:Clone()
	local Aura2 = aura.Embers:Clone()
	local EyeRedLeft = aura:WaitForChild("ParticleEmitterRedLeft")
	local EyeRedRight = aura:WaitForChild("ParticleEmitterRedRight")
	local Shineleft = aura.shineLeft:Clone()
	local ShineRight = aura.shineRight:Clone()
	local AuraBloom1 = aura.Aura1Bloom:Clone()
	local AuraBloom2 = aura.AuraBloom2:Clone()


	local Head = Character.Head
	local RightArm = Character["Right Arm"]
	local LeftArm = Character["Left Arm"]
	local LeftLeg = Character["Left Leg"]
	local RightLeg = Character["Right Leg"]
	local Torso = Character.Torso
	local HumanoidRootPart = Character.HumanoidRootPart
	--Attachments

	local AttachmentLeft = Instance.new("Attachment")
	AttachmentLeft.Position = Vector3.new(0.204, 0.221, -0.6)
	AttachmentLeft.Name = "AttachmentLeft"
	AttachmentLeft.Parent = Head


	local AttachmentRight = Instance.new("Attachment")
	AttachmentRight.Position = Vector3.new(-0.192, 0.216, -0.6)
	AttachmentRight.Name = "AttachmentRight"
	AttachmentRight.Parent = Head


	local SpecialPartAttachment1 = Instance.new("Attachment")
	--SpecialPartAttachment1.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,-2.32,0)
	SpecialPartAttachment1.Name = "SpecialPartAttachment1"


	local SpecialPartAttachment2 = Instance.new("Attachment")
	--SpecialPartAttachment2.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,-2.32,0)
	SpecialPartAttachment2.Name = "SpecialPartAttachment1"


	local SpecialAttachment3 = Instance.new("Attachment")
	SpecialAttachment3.Name = "SpecialAttachment3"

	local SpecialAttachment4 = Instance.new("Attachment")
	SpecialAttachment4.Name = "SpecialAttachment4"


	--SpecialAttachment3.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,-2.32,0)


	Aura1:Clone().Parent = RightArm
	Aura2:Clone().Parent = RightArm

	Aura1:Clone().Parent = LeftArm
	Aura2:Clone().Parent = LeftArm

	Aura1:Clone().Parent = Torso
	Aura2:Clone().Parent = Torso

	Aura1:Clone().Parent = LeftLeg
	Aura2:Clone().Parent = LeftLeg

	Aura1:Clone().Parent = RightLeg
	Aura2:Clone().Parent = RightLeg

	EyeRedLeft:Clone().Parent = AttachmentLeft

	EyeRedRight:Clone().Parent = AttachmentRight

	--Making a New Part
	local AwakenAura = Instance.new("Part")
	AwakenAura.Name = "AwakenAura"
	AwakenAura.Parent = HumanoidRootPart
	AwakenAura.Size = Vector3.new(1, 0.1, 1)
	AwakenAura.Massless = true
	AwakenAura.CanCollide = false

	AwakenAura:Clone()
	local weld = Instance.new("WeldConstraint")
	weld.Part0 = HumanoidRootPart
	weld.Part1 = AwakenAura
	weld.Part1.Anchored = false
	AwakenAura.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,-2.32,0)
	AwakenAura.Parent = HumanoidRootPart
	weld.Parent = HumanoidRootPart -- NEED TO PARENT THE WELD TOO OR ITS GONNA FALL THROUGH THE MAP

	SpecialPartAttachment1.Parent = AwakenAura
	SpecialPartAttachment2.Parent = AwakenAura
	SpecialAttachment3.Parent = AwakenAura

	AuraBloom1:Clone().Parent = SpecialPartAttachment1
	AuraBloom2:Clone().Parent = SpecialPartAttachment2
	ShineRight:Clone().Parent = SpecialAttachment3
	Shineleft:Clone().Parent = SpecialAttachment3

end

function Module.UniqueAura(player, UserId, Character)

	local replicatedstorage = game:GetService("ReplicatedStorage")
	local aura = replicatedstorage.Aura
	local Aura1 = aura.Aura1Effect:Clone()
	local Aura2 = aura.Embers:Clone()
	local EyeRedLeft = aura:WaitForChild("ParticleEmitterRedLeft")
	local EyeRedRight = aura:WaitForChild("ParticleEmitterRedRight")
	local Shineleft = aura.shineLeft:Clone()
	local ShineRight = aura.shineRight:Clone()
	local AuraBloom1 = aura.Aura1Bloom:Clone()
	local AuraBloom2 = aura.AuraBloom2:Clone()


	local Head = Character.Head
	local RightArm = Character["Right Arm"]
	local LeftArm = Character["Left Arm"]
	local LeftLeg = Character["Left Leg"]
	local RightLeg = Character["Right Leg"]
	local Torso = Character.Torso
	local HumanoidRootPart = Character.HumanoidRootPart


	local AttachmentLeft = Instance.new("Attachment")
	AttachmentLeft.Position = Vector3.new(0.204, 0.221, -0.6)
	AttachmentLeft.Name = "AttachmentLeft"
	AttachmentLeft.Parent = Head

	local AttachmentRight = Instance.new("Attachment")
	AttachmentRight.Position = Vector3.new(-0.192, 0.216, -0.6)
	AttachmentRight.Name = "AttachmentRight"
	AttachmentRight.Parent = Head


	local SpecialPartAttachment1 = Instance.new("Attachment")
	--SpecialPartAttachment1.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,-2.32,0)
	SpecialPartAttachment1.Name = "SpecialPartAttachment1"


	local SpecialPartAttachment2 = Instance.new("Attachment")
	--SpecialPartAttachment2.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,-2.32,0)
	SpecialPartAttachment2.Name = "SpecialPartAttachment1"


	local SpecialAttachment3 = Instance.new("Attachment")
	SpecialAttachment3.Name = "SpecialAttachment3"

	local SpecialAttachment4 = Instance.new("Attachment")
	SpecialAttachment4.Name = "SpecialAttachment4"


	--SpecialAttachment3.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,-2.32,0)

	Aura1:Clone().Parent = RightArm
	Aura2:Clone().Parent = RightArm

	Aura1:Clone().Parent = LeftArm
	Aura2:Clone().Parent = LeftArm

	Aura1:Clone().Parent = Torso
	Aura2:Clone().Parent = Torso

	Aura1:Clone().Parent = LeftLeg
	Aura2:Clone().Parent = LeftLeg

	Aura1:Clone().Parent = RightLeg
	Aura2:Clone().Parent = RightLeg

	EyeRedLeft:Clone().Parent = AttachmentLeft

	EyeRedRight:Clone().Parent = AttachmentRight

	--Making a New Part
	local AwakenAura = Instance.new("Part")
	AwakenAura.Name = "AwakenAura"
	AwakenAura.Parent = HumanoidRootPart
	AwakenAura.Size = Vector3.new(1, 0.1, 1)
	AwakenAura.Massless = true
	AwakenAura.CanCollide = false

	AwakenAura:Clone()

	local weld = Instance.new("WeldConstraint")
	weld.Part0 = HumanoidRootPart
	weld.Part1 = AwakenAura
	weld.Part1.Anchored = false
	AwakenAura.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,-2.32,0)
	AwakenAura.Parent = HumanoidRootPart
	weld.Parent = HumanoidRootPart -- NEED TO PARENT THE WELD TOO OR ITS GONNA FALL THROUGH THE MAP

	SpecialPartAttachment1.Parent = AwakenAura
	SpecialPartAttachment2.Parent = AwakenAura
	SpecialAttachment3.Parent = AwakenAura

	AuraBloom1:Clone().Parent = SpecialPartAttachment1
	AuraBloom2:Clone().Parent = SpecialPartAttachment2
	ShineRight:Clone().Parent = SpecialAttachment3
	Shineleft:Clone().Parent = SpecialAttachment3

	Aura1.Color = ColorSequence.new(Color3.new(1, 1, 1))
	Aura2.Color = ColorSequence.new(Color3.new(0, 0, 0))
	EyeRedLeft.Color = ColorSequence.new(Color3.new(0.709804, 0.698039, 0.290196))
	EyeRedRight.Color = ColorSequence.new(Color3.new(0.709804, 0.698039, 0.290196))

	AuraBloom1.Color = ColorSequence.new(Color3.new(0.709804, 0.698039, 0.290196))
	AuraBloom2.Color = ColorSequence.new(Color3.new(0.709804, 0.698039, 0.290196))
	ShineRight.Color = ColorSequence.new(Color3.new(0.941176, 0.941176, 0.941176))
	Shineleft.Color = ColorSequence.new(Color3.new(0.941176, 0.941176, 0.941176))

end




function Module.TurnOffAura(player, UserId, Character)
	if not Character then return end
	local AwakenPart = Character.HumanoidRootPart.AwakenAura

	Character.Head.AttachmentLeft:Destroy()
	Character.Head.AttachmentRight:Destroy()

	for _, Decendant in pairs(Character:GetDescendants()) do
		if  Decendant.ClassName == "ParticleEmitter" then
			Decendant:Destroy()
			AwakenPart:Destroy()

		end

	end

end


return Module

Try this as the module code:

local replicatedstorage = game:GetService("ReplicatedStorage")
local aura = replicatedstorage.Aura

local players = {};
return function(player)
	if(players[player.UserId]) then return players[player.UserId]
	else
		local Aura1;
		local Aura2;
		local EyeRedLeft;
		local EyeRedRight;
		local Shineleft;
		local ShineRight;
		local AuraBloom1;
		local AuraBloom2;
		
		local module = {};
		function module:Aura()
			local character = player.Character;
			
			local Head = character.Head;
			local RightArm = character:WaitForChild("Right Arm");
			local LeftArm = character:WaitForChild("Left Arm");
			local RightLeg = character:WaitForChild("Right Leg");
			local LeftLeg = character:WaitForChild("Left Leg");
			
			local Torso = character.Torso;
			local HumanoidRootPart = character.HumanoidRootPart;
			
			local aL = Instance.new("Attachment", Head);
			aL.Position = Vector3.new(0.204,0.221,-0.6);
			aL.Name = "AttachmentLeft";
			
			local aR = Instance.new("Attachment", Head);
			aR.Position = Vector3.new(-0.192,0.216,-0.6);
			aR.Name = "AttachmentRight";
			
			Aura1 = aura.Aura1Effect:Clone();
			Aura2 = aura.Embers:Clone();
			EyeRedLeft = aura:WaitForChild("ParticleEmitterRedLeft");
			EyeRedRight = aura:WaitForChild("ParticleEmitterRedRight");
			Shineleft = aura.shineLeft:Clone();
			ShineRight = aura.shineRight:Clone();
			AuraBloom1 = aura.Aura1Bloom:Clone();
			AuraBloom2 = aura.AuraBloom2:Clone();
			
			Aura1.Parent = RightArm;
			Aura2.Parent = RightArm;

			Aura1.Parent = LeftArm;
			Aura2.Parent = LeftArm;

			Aura1.Parent = Torso;
			Aura2.Parent = Torso;

			Aura1.Parent = LeftLeg;
			Aura2.Parent = LeftLeg;

			Aura1.Parent = RightLeg;
			Aura2.Parent = RightLeg;

			EyeRedLeft.Parent = aL;
			EyeRedRight.Parent = aR;
			
			local awakenAura = Instance.new("Part", HumanoidRootPart);
			awakenAura.Name = "AwakenAura";
			awakenAura.Size = Vector3.new(1, 0.1, 1);
			awakenAura.Massless = true;
			awakenAura.CanCollide = false;
			
			local weld = Instance.new("WeldConstraint", HumanoidRootPart);
			weld.Part0 = HumanoidRootPart;
			weld.Part1 = awakenAura;
			awakenAura.CFrame = HumanoidRootPart.CFrame * CFrame.new(0,-2.32,0);
			
			local sPAttachment1 = Instance.new("Attachment", awakenAura);
			sPAttachment1.Name = "SpecialPartAttachment1";


			local sPAttachment2 = Instance.new("Attachment", awakenAura);
			sPAttachment2.Name = "SpecialPartAttachment2";
			
			local sAttachment3 = Instance.new("Attachment", awakenAura);
			sAttachment3.Name = "SpecialAttachment3";
			
			AuraBloom1.Parent = sPAttachment1;
			AuraBloom2.Parent = sPAttachment2;
			ShineRight.Parent = sAttachment3;
			Shineleft.Parent = sAttachment3;
		end;
		
		function module:UniqueAura()
			Aura1.Color = ColorSequence.new(Color3.new(1, 1, 1));
			Aura2.Color = ColorSequence.new(Color3.new(0, 0, 0));
			EyeRedLeft.Color = ColorSequence.new(Color3.new(0.709804, 0.698039, 0.290196));
			EyeRedRight.Color = ColorSequence.new(Color3.new(0.709804, 0.698039, 0.290196));

			AuraBloom1.Color = ColorSequence.new(Color3.new(0.709804, 0.698039, 0.290196));
			AuraBloom2.Color = ColorSequence.new(Color3.new(0.709804, 0.698039, 0.290196));
			ShineRight.Color = ColorSequence.new(Color3.new(0.941176, 0.941176, 0.941176));
			Shineleft.Color = ColorSequence.new(Color3.new(0.941176, 0.941176, 0.941176));
		end;
		
		function module:TurnOffAura()
			local character = player.Character;
			
			if not character then return end;
			local AwakenPart = character.HumanoidRootPart:WaitForChild("AwakenAura");

			character.Head:WaitForChild("AttachmentLeft"):Destroy()
			character.Head:WaitForChild("AttachmentRight"):Destroy()

			for _, Decendant in pairs(character:GetDescendants()) do
				if(Decendant.ClassName == "ParticleEmitter") then
					Decendant:Destroy();
					AwakenPart:Destroy();
				end
			end
		end;

		players[player.UserId] = module;
		return module;
	end;
end;

And this as the script code:

local AuraRemote = script.Parent
local AuraModule = require(game.StarterPlayer.StarterCharacterScripts:WaitForChild("Aura!"):WaitForChild("AuraModule"))

local playerID = {
	58508301,
	15454353, 
	2023345
};

AuraRemote.OnServerEvent:Connect(function(player,  On)
	local playerModule = AuraModule(player);
	
	local character = player.Character;
	if(On == true) then
		print("Hey I printed!");

		local found = false;
		for i, v in pairs(playerID) do
			if(v == player.UserId) then
				warn("Yes")
				playerModule:Aura()
				playerModule:UniqueAura()

				found = true
				break
			end
		end

		if(not found) then
			warn("No!")
			playerModule:Aura()
			task.wait(1)
			warn("Awakened")
		end
	else
		playerModule:TurnOffAura()
		warn("Normal Form")
	end
end);

I’ll check tomorrow, hopefully it works

1 Like

Its only giving me part of the aura for some reason /:
image

Its only giving me part of the aura

Oooh theres just a weld problem [FIXED IT]

Okay I fixed all the other problems, it seems to work fine! Could you explain the module script when you have time? Thanks for the help lol this took like 2 days

1 Like

So first I saw that you were needing the player in every function, if you need the player in almost every function then you might as well just give it once rather than sending it every time. So to fix the variable problem rather than having a module for everyone I made the module return a function. The function will create a module for the player and cache it in case you need it again.

--Instead of:
module:Aura(player);
module:UniqueAura(player);

--It is:
local playerModule = module(player);
playerModule:Aura();
playerModule:UniqueAura();

This will get rid of the globalization problem since it is per-player as well as make it neater rather than needing to send the player every time.

2 Likes

Hmm I think i understand a bit… I’ll just have to practice more with the code.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.