What does this error mean?

Pretty straightforward title, what does this error mean?

i’m trying to use tweening on a tool so it moves smoothly, all i want to find out is what the error is and attempt to fix it

here’s the code the error is referencing if anyone needs it:

Code
local Animations = {}

local TweenSpeed = 0.1
local EasingStyle = Enum.EasingStyle.Sine

local TS = game:GetService("TweenService")

function Animations:Tween(Object, properties)
	local TI = TweenInfo.new(TweenSpeed, EasingStyle)
	local tween = TS:Create(Object, TI, properties)
	tween:Play()
end

return Animations

yes it’s in a module script, it’s a child of a local script inside the tool

Could you post the code in the LocalScript, and give us a screenshot of the explorer?

1 Like
Local Script code
local Animations = require(script:WaitForChild("Animations"))

local RayTraces = 24
local Spread = script.Parent.Spread.Value

function CreateLightBounce(X, Y)
	local Part = Instance.new("Part")
	Part.Parent = script.Parent
	Part.CanCollide = false
	Part.Anchored = true
	Part.Size = Vector3.new(0,0,0)
	Part.Transparency = 1
	Part.Name = "RayTrace"

	local PointLight = Instance.new("PointLight")
	PointLight.Shadows = true
	PointLight.Range = 30
	PointLight.Color = script.Parent.Attachment.SpotLight.Color

	PointLight.Parent = Part


	game["Run Service"].RenderStepped:Connect(function()

		local Origin = script.Parent.CFrame.Position
		local Direction = (script.Parent.CFrame * CFrame.Angles(math.rad(X), math.rad(Y), 0)).LookVector * 1000

		local RayParams = RaycastParams.new()
		RayParams.FilterDescendantsInstances = {script.Parent:GetChildren(), game.Players.LocalPlayer.Character}
		RayParams.FilterType = Enum.RaycastFilterType.Blacklist

		local rayResult = workspace:Raycast(Origin, Direction, RayParams)

		if rayResult then

			if script.Parent.On.Value == true then
				
				script.Parent.Attachment.SpotLight.Enabled = true

				for i, v in pairs(script.Parent:GetChildren()) do
					if v.Name == "RayTrace" then
						v.PointLight.Enabled = true
					end
				end

				Animations:Tween(script.Parent.Parent, {Color = Color3.fromRGB(255, 255, 255)}, 0.1)

				
				
				if rayResult.Material == Enum.Material.Glass then
					Animations:Tween(script.Parent.Attachment.SpotLight, {Color = rayResult.Instance.Color}, 0.1)
				else
					Animations:Tween(script.Parent.Attachment.SpotLight, {Color = Color3.fromRGB(255, 255, 255)}, 0.1)
				end

				local Distance = 1 / (Origin - rayResult.Position).Magnitude / 6
				
				Distance = math.clamp(Distance, 0, 0.25)

				Animations:Tween(PointLight, {Color = rayResult.Instance.Color}, 0.1)

				PointLight.Brightness = Distance

				Part.Position = rayResult.Position
				
			else

				Animations:Tween(script.Parent.SurfaceLight, {Color = Color3.fromRGB(0, 0, 0)}, 0.1)

				Animations:Tween(script.Parent.Parent, {Color = Color3.fromRGB(0, 0, 0)}, 0.1)

				for i, v in pairs(script.Parent:GetChildren()) do
					if v.Name == "RayTrace" then
						Animations:Tween(PointLight, {Color = Color3.fromRGB(0, 0, 0)}, 0.1)
					end
				end

			end

		end

	end)

end

for i = 0, RayTraces do
	local x, y = math.random(-Spread*100, Spread*100) / 100, math.random(-Spread*100, Spread*100) / 100
	CreateLightBounce(x, y)
end
Explorer Screenshot

image

script.Parent.Parent here is referring to the LocalScript called Flashlight.
A LocalScript does not have a property called Color, hence the error.

script.Parent.Parent needs to be changed to refer to the correct Instance that has the Color property you want to change

1 Like

If my reply solved your issue, could you mark it as the solution :smile:

1 Like

sorry i’m just playing around with some stuff right now to see if it’s really solved, I’m having some more unrelated issues