You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to achieve it so when you touch this green part, the top image label turns grey, and the bottom turns red, with a smooth effect which is where I’ve got, but it doesn’t turn to red.
What is the issue? Include screenshots / videos if possible!
It is failing to work at the moment, causing issues. Development Bug - YouTube
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I asked a friend, provided some code and he couldn’t figure it out.
local part = script.Parent
local humanoid
local Sensor1 = script.Parent
local Signal = script.Parent.Parent
part.Touched:Connect(function(other)
if other.Parent ~= nil then
humanoid = other.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
script.Parent.Touched:Connect(function()
script.Parent.Parent.Part.SurfaceGui.TopLabel.ImageColor = (15, 15, 15)
script.Parent.Parent.Part.SurfaceGui.BottomLabel.ImageColor = (255, 0, 0)
end)
if humanoid then
humanoid.Died:Connect(function()
part.Touched:Disconnect
end)
end
You don’t need to disconnect it, you could have a debounce instead.
try this
local part = script.Parent
local Sensor1 = script.Parent
local Signal = script.Parent.Parent
part.Touched:Connect(function(other)
if other.Parent ~= nil then
local humanoid = other.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
script.Parent.Parent.Part.SurfaceGui.TopLabel.ImageColor = (15, 15, 15)
script.Parent.Parent.Part.SurfaceGui.BottomLabel.ImageColor = (255, 0, 0)
end
end
part.Touched:Connect(function(other)
if other.Parent ~= nil then
local humanoid = other.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
script.Parent.Parent.Part.SurfaceGui.TopLabel.ImageColor = (15, 15, 15)
script.Parent.Parent.Part.SurfaceGui.BottomLabel.ImageColor = (255, 0, 0)
end
end
end)
It says
“Expected ‘end’ (to close ‘then’ at line 9), got < eof >; did you forget to close ‘fundction’ at line 16?”
You’re missing some parameters and some end parts of the script
local part = script.Parent
local Sensor1 = script.Parent
local Signal = script.Parent.Parent
part.Touched:Connect(function(other)
if other.Parent ~= nil then
local humanoid = other.Parent:FindFirstChildOfClass("Humanoid")
if humanoid then
script.Parent.Parent.Part.SurfaceGui.TopLabel.ImageColor = (15, 15, 15)
script.Parent.Parent.Part.SurfaceGui.BottomLabel.ImageColor = (255, 0, 0)
end
end
end)
Basically, when you touch the green part, the signal turns from green to red in a smooth transition. This was a temporary thing until I figured out how to make a signalling system like the UK, look it up but I don’t have the skill for that.
local part = script.Parent
local colorChanger = workspace.Part --("The thing changing colors I guess")
---Tween Service is pretty complicated so if you want to use it in an different script I'd advise you to watch a tutorial---
local TweenService = game:GetService("TweenService")
local info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
local changeTheColorSmoothly = TweenService:Create(colorChanger, info, {Color = Color3.fromRGB(255, 0, 0)})
----------------------------------------------------------------------------------------------------------------------------
part.Touched:Connect(function(hit)
if hit.Parent then
if hit.Parent:FindFirstChild("Humanoid") then
changeTheColorSmoothly:Play()
end
end
end)
Just telling you I haven’t seen anything about the UK signaling system
Aside from some logical problems your code also has some syntactical problems.
ImageColor does not exist only ImageColor3 and if its a TextLabel ImageColor3 isn’t even an option maybe TextColor3 or BackgroundColor3?
Also using strings or tupples aren’tt the correct type of data, you would need to make from the Color3 type so Color3.fromRGB(15, 15, 15)