Changing the properties of something in a tool when tool is activated

So lately Ive been trying to accomplish something.

When a certain tool is activated, it will change a property that is in the tool

Here is the script I am using:

local tool = script.Parent

function onActivation()
	print("Tool activated")
	tool.Handle.Trail.Transparency = (0.5)
end

tool.Activated:Connect(onActivation)

What its supposed to do is, when tool is activated, it will make the trail that is in the handle in the tool visible.

But it doesn’t

Can someone tell me what I’m doing wrong?
Thanks for your time.

The script looks good, only mistake is that trail transparency is different from other transparency, like part transparency. Since, trails fade out and in, they have what we call a NumberSequence. You can think of it like Color Gradients.

local tool = script.Parent

function onActivation()
	print("Tool activated")
	tool.Handle.Trail.Transparency = NumberSequence.new{
    NumberSequenceKeypoint.new(0, 0), -- First Point in the Sequence, first number is the time it starts,  second number is the transparency it starts with
    NumberSequenceKeypoint.new(1, 1) -- Second Point in the sequence, first number is the time it ends, and second number is the  transparency it'll end with
}
end

tool.Activated:Connect(onActivation)

So if you wanted the transparency of the trail to always be 0.5 you’d do something like this

local tool = script.Parent

function onActivation()
	print("Tool activated")
	tool.Handle.Trail.Transparency = NumberSequence.new{
    NumberSequenceKeypoint.new(0, 0.5), -- First Point in the Sequence, first number is the time it starts,  second number is the transparency it starts with
    NumberSequenceKeypoint.new(1, 0.5) -- Second Point in the sequence, first number is the time it ends, and second number is the  transparency it'll end with
}
end

tool.Activated:Connect(onActivation)
1 Like