The two highlighted lines do not change the Frame color. Help me please.
local DeletePart = script.Parent.Parent.Delete
local Green = script.Parent.Parent.Signals.Green
local Red = script.Parent.Parent.Signals.Red
local Signal1 = script.Parent.Parent.Signal1
local Signal2 = script.Parent.Parent.Signal2
local Manual = game.ServerStorage.Values.Manual1
local SignallerMenu = game.StarterGui.SignallerMenu
local GreenSignallerMenu = SignallerMenu.Frame.Signalls.Signall.Green
local RedSignallerMenu = SignallerMenu.Frame.Signalls.Signall.Red
function onTouched(part)
print("Касание красного маркера (Signal1)")
if Manual.Value == false then
print("Не в ручном управлении (Signal1)")
print(part.Name)
if part.Name == "SignalPart" then
print("Красный включен (Signal1)")
Red.BrickColor = BrickColor.Red()
Green.BrickColor = BrickColor.new("Black")
Signal1.Value = BrickColor.new("Really red")
Signal2.Value = BrickColor.new("Black")
DeletePart.Script.Enabled = true
--does not change
GreenSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
RedSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0.886275, 1)
--end of the gods
end
end
end
script.Parent.Touched:connect(onTouched)
local DeletePart = script.Parent.Parent.Delete
local Green = script.Parent.Parent.Signals.Green
local Red = script.Parent.Parent.Signals.Red
local Signal1 = script.Parent.Parent.Signal1
local Signal2 = script.Parent.Parent.Signal2
local Manual = game.ServerStorage.Values.Manual1
local SignallerMenu = game:GetService("Players").LocalPlayer.PlayerGui:WaitForChild("SignallerMenu")
local GreenSignallerMenu = SignallerMenu.Frame.Signalls.Signall.Green
local RedSignallerMenu = SignallerMenu.Frame.Signalls.Signall.Red
function onTouched(part)
print("Касание красного маркера (Signal1)")
if Manual.Value == false then
print("Не в ручном управлении (Signal1)")
print(part.Name)
if part.Name == "SignalPart" then
print("Красный включен (Signal1)")
Red.BrickColor = BrickColor.Red()
Green.BrickColor = BrickColor.new("Black")
Signal1.Value = BrickColor.new("Really red")
Signal2.Value = BrickColor.new("Black")
DeletePart.Script.Enabled = true
GreenSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
RedSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0.886275, 1)
end
end
end
script.Parent.Touched:connect(onTouched)
Are there any errors?
Edit: Is this a server script or a local script? You can’t access ServerStorage from a local script. If this is a server script, then you also can’t use game:GetService(“Players”).LocalPlayer
If your script is a server script, do this:
local DeletePart = script.Parent.Parent.Delete
local Green = script.Parent.Parent.Signals.Green
local Red = script.Parent.Parent.Signals.Red
local Signal1 = script.Parent.Parent.Signal1
local Signal2 = script.Parent.Parent.Signal2
local Manual = game.ServerStorage.Values.Manual1
function onTouched(part)
local Humanoid = part.Parent:FindFirstChild("Humanoid")
if Humanoid then
local SignallerMenu = game:GetService("Players"):FindFirstChild(Humanoid.Parent.Name).PlayerGui:WaitForChild("SignallerMenu")
local GreenSignallerMenu = SignallerMenu.Frame.Signalls.Signall.Green
local RedSignallerMenu = SignallerMenu.Frame.Signalls.Signall.Red
print("Касание красного маркера (Signal1)")
if Manual.Value == false then
print("Не в ручном управлении (Signal1)")
print(part.Name)
if part.Name == "SignalPart" then
print("Красный включен (Signal1)")
Red.BrickColor = BrickColor.Red()
Green.BrickColor = BrickColor.new("Black")
Signal1.Value = BrickColor.new("Really red")
Signal2.Value = BrickColor.new("Black")
DeletePart.Script.Enabled = true
GreenSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
RedSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0.886275, 1)
end
end
end
end
You have to be a bit more clear than it just doesn’t work. We need errors or you need to put print statements into your code block so we can trace the problem.
If this doesn’t work for you, then the problem is not with the code, but with where the script is, or a missing asset or some other logic problem.
local PlayerServ = game:GetService("Players")
local ServerStor = game:GetService("ServerStorage")
local DeletePart = script.Parent.Parent.Delete
local Green = script.Parent.Parent.Signals.Green
local Red = script.Parent.Parent.Signals.Red
local Signal1 = script.Parent.Parent.Signal1
local Signal2 = script.Parent.Parent.Signal2
local Manual = ServerStor.Values.Manual1 --game.ServerStorage.Values.Manual1
function onTouched(part)
local humanoid = part.Parent:FindFirstChild("Humanoid")
if(not(humanoid))then return end --Did not find humanoid
local player = PlayerServ:GetPlayerFromCharacter(humanoid.Parent)
if(not(player))then return end --No player associated with char
local signallerMenu = player.PlayerGui:FindFirstChild("SignallerMenu")
if(not(signallerMenu))then return end --Couldn't find it
--local SignallerMenu = player.PlayerGui:WaitForChild("SignallerMenu") --THIS CAN HANG, WAITING, CAUSE TIMEOUT
local GreenSignallerMenu = signallerMenu.Frame.Signalls.Signall.Green
local RedSignallerMenu = signallerMenu.Frame.Signalls.Signall.Red
print("Касание красного маркера (Signal1)")
if(Manual.Value)then return end --Value was true
print("Не в ручном управлении (Signal1)")
print(part.Name)
if(part.Name ~= "SignalPart")then return end --Part was not named "SignalPart"
print("Красный включен (Signal1)")
Red.BrickColor = BrickColor.Red()
Green.BrickColor = BrickColor.new("Black")
Signal1.Value = BrickColor.new("Really red")
Signal2.Value = BrickColor.new("Black")
DeletePart.Script.Enabled = true
GreenSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0, 0)
RedSignallerMenu.BackgroundColor3 = Color3.fromHSV(0, 0.886275, 1)
end
script.Parent.Touched:Connect(onTouched)