Unique Aura Glitches when someone else uses it

So basically if It has the unique ID it’ll give unique Aura, but if they don’t have it it gives them regular aura. But the thing is when someone with the unique aura turns it on the other person gets it too. how to fix?

Regular Is Purple, Unique is Gold

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

local playerID = {
	58508301,
	15454353, 
	2023345}


AuraRemote.OnServerEvent:Connect(function(player,  On)
	local character = player.Character
	local Humanoid = character.Humanoid
	local HumanoidRootPart = character.HumanoidRootPart
	if  On == true then 
		
		
		
		if table.find(playerID, player.UserId) then
				AuraModule.UniqueAura(player.UserId,  character)	
		end
		
		AuraModule.Aura(player, player.UserId,  character)
		task.wait(1)
		warn("Awakened")
	
	else
		
		
		
		AuraModule.TurnOffAura(player, player.UserId,  character)

I am pretty sure there is something wrong between this two function

if it’s not too much can i see the code inside the function or even better show this function too

Yeah here we go my bad, I noticed that the functions were global instead of local so i changed for everyone, whats the best way to change that?

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 playerID = {
	58508301,
	15454353, 
	2023345

}


local Module = { }
--(player, player.UserId,  character)
function Module.Aura(player, UserId,Character)

	

		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)
	
			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

Alright so here is a explaination

You change color of the base aura that will be cloned (that work right?) but the thing is after you change aura color then next time player call Aura function again they will clone the aura that still have color changed

for the fix i am trying to fix the code without changing your code much but if you want faster way it would be me re-write your code abit (not all)

I also noticed I didn’t add the particles to the unique aura, i just recolored it which is probably bad because it wont give me aura.

Yeah its fine as long as you can explain it in the code

By the way someone else did fix the script for me just now but I still want to know different methods of fixing this because i want to learn more [ Like with global functions and variables that change for everyone and local functions and variables that only change for the client]

Well nothing change much since i don’t know if it will error on another part so i decide to insert more script instead of edit
i editted only Unique aura function and abit on remote script

Unique Aura function

function Module.UniqueAura(player, UserId, Character)
	local oldColor = {
		["Aura1"] = Aura1.Color;
		["Aura2"] = Aura2.Color;
		["EyeRedLeft"] = EyeRedLeft.Color;
		["EyeRedRight"] = EyeRedRight.Color;
		["AuraBloom1"] = AuraBloom1.Color;
		["AuraBloom2"] = AuraBloom2.Color;
		["ShineRight"] = ShineRight.Color;
		["Shineleft"] = Shineleft.Color
	}

	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))
	
	Module.Aura(player,UserId, Character) --Create Aura here
	
	--Set all aura color to old color (Very hard coded if you have chance to re-write in future avoid this)
	Aura1.Color = oldColor["Aura1"]
	Aura2.Color = oldColor["Aura2"]
	EyeRedLeft.Color = oldColor["EyeRedLeft"]
	EyeRedRight.Color = oldColor["EyeRedRight"]

	AuraBloom1.Color = oldColor["AuraBloom1"]
	AuraBloom2.Color = oldColor["AuraBloom2"]
	ShineRight.Color = oldColor["ShineRight"]
	Shineleft.Color = oldColor["Shineleft"]
end

Remote Script

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

local playerID = {
	58508301,
	15454353, 
	2023345
}


AuraRemote.OnServerEvent:Connect(function(player,  On)
	local character = player.Character
	local Humanoid = character.Humanoid
	local HumanoidRootPart = character.HumanoidRootPart
	if  On == true then 

		if table.find(playerID, player.UserId) then
			AuraModule.UniqueAura(player, player.UserId,  character)	
		else
			AuraModule.Aura(player, player.UserId,  character)
		end

		task.wait(1)
		warn("Awakened")

	else

		AuraModule.TurnOffAura(player, player.UserId,  character)
	end
end)	

Editted note: So you never actually pass player instance on Unique aura function too (but since it do nothing before in your code there are no error but i editted to pass player instance too and Create Aura function now only run if player isn’t on the list i also insert Create aura function call in Unique Aura function)

Last note: this is very hard coded i still advise you to avoid the repeat line in the future

Alright well I’ll look into this code and try to study on it. Thanks for the help

I have never used global variables myself and you require module from StarterCharacterScripts the script inside that folder will be parented to each player character when they join

if you open your character in explorer you will see Aura! folder inside your character

well this maybe too long but if you still want more detail explaination PM me instead-

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