Hi, my code keeps getting this error message. I've tried adjusting the 'end's, rewriting the code and looking at multiple different forums to find other solutions. These having not worked. , I'm really lost. Any help/clues or criticism is appreciated.
local part = script.Parent; local Players = game:GetService("Players"); local screen = script.Parent.Parent.Screen local SurfaceLight = screen.SurfaceLight local part = script.Parent part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid"); if humanoid then local player = Players:GetPlayerFromCharacter(hit.Parent); screen.Material = Enum.Material.Neon SurfaceLight.Enabled = true end part.TouchEnded:Connect(function(hit) local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid"); if humanoid then local player = Players:GetPlayerFromCharacter(hit.Parent); if part.Touched:Connect(function(hit) wait(2) if part.Touched:Connect(function(hit) screen.Material = Enum.Material.Neon SurfaceLight.Enabled = true end) then elseif part.Touched:Connect(function(hit) screen.Material = Enum.Material.SmoothPlastic SurfaceLight.Enabled = false end) then end end)
i removed if and elseif at line 19, 21 and 25, you dont need it
local part = script.Parent; local Players = game:GetService("Players"); local screen = script.Parent.Parent.Screen local SurfaceLight = screen.SurfaceLight local part = script.Parent part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid"); if humanoid then local player = Players:GetPlayerFromCharacter(hit.Parent); screen.Material = Enum.Material.Neon SurfaceLight.Enabled = true end part.TouchEnded:Connect(function(hit) local humanoid = hit.Parent:FindFirstChildOfClass("Humanoid"); if humanoid then local player = Players:GetPlayerFromCharacter(hit.Parent); part.Touched:Connect(function(hit) wait(2) part.Touched:Connect(function(hit) screen.Material = Enum.Material.Neon SurfaceLight.Enabled = true end) part.Touched:Connect(function(hit) screen.Material = Enum.Material.SmoothPlastic SurfaceLight.Enabled = false end) end end)