I cant Change Trail.Color

  1. I Want to Achieve so When I touch the player the Trail Color Changes Keep it simple and clear!

  2. Trail Color is not changing when I touch the player Include screenshots / videos if possible!

  3. Yes I did Look for solutions on the dev hub Did you look for solutions on the Developer Hub?

-- game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)


		while wait() do

			local Teams = game:GetService("Teams")


			if player.Team == Teams["Seeker"] then

				local debounce = false

				char:WaitForChild("HumanoidRootPart").Touched:Connect(function(hit)
					local hum = hit.Parent:FindFirstChild("Humanoid")
					local player = game.Players:GetPlayerFromCharacter(hit.Parent)
					if hum then
						if player then

							if debounce == false then
								debounce = true
								wait(0.5)
								player.Team = game.Teams.Seeker
								hum.Parent.Head.Trail.Color = Color3.fromRGB(255,0,4)
								print("Hit a player")
								wait(1)
								debounce = false
							end
						end
					end
				end)
			end
		end
	end)
end)

It’s because trails take in a ColorSequence not a Color3. So, you would have to say something like this:

hum.Parent.Head.Trail.Color = ColorSequence.new(Color3.fromRGB(255,0,0), Color3.fromRGB(255,0,0))

First argument represents the start and the last value represents the end value.

You can find a lot of information on trails here

1 Like

You have to use a ColorSequence.

New code:

--//Services
local Players = game:GetService("Players")
local Teams = game:GetService("Teams")

--//Variables
local Seeker = Teams:WaitForChild("Seeker")

--//Functions
local function InitializeSeeker(character)
	local HumanoidRootPart = character:WaitForChild("HumanoidRootPart")
	local debounce = false

	HumanoidRootPart.Touched:Connect(function(hit)
		if debounce then
			return
		end
		
		local Player = Players:GetPlayerFromCharacter(hit.Parent)
		
		if not Player then
			return
		end
		
		debounce = true
		
		task.wait(0.5)
		Player.Team = Seeker
		Player.Character.Head.Trail.Color = ColorSequence.new(Color3.fromRGB(255,0,4))
		
		print("Hit a player")

		task.wait(1)
		debounce = false
	end)
end

Players.PlayerAdded:Connect(function(player)	
	player.CharacterAdded:Connect(function(character)
		if player.Team == Seeker then
			InitializeSeeker(character)
		end
		
		player:GetPropertyChangedSignal("Team"):Connect(function()
			if player.Team == Seeker then
				InitializeSeeker(character)
			end
		end)
	end)
end)
2 Likes

your script wasnt working well but i fixed my old one (i forgot trails use colorsequence)
BIG thank you for you guys helping me out! :grinning:

1 Like