Yes... I've asked a few questions today, but this one is the one that's bugging me most. When F is pressed, this light will turn green on a Panel. But it didn't work. Here's the code:
script.Parent.MouseHoverEnter:Connect(function(plr) game.Players[plr.Name].PlayerGui.InteractionMenu.Enabled = true game.Players[plr.Name].PlayerGui.InteractionMenu.ItemName.Text = "Control Panel" game.Players[plr.Name].PlayerGui.InteractionMenu.HoldF.Text = "Hit [F] to open door" script.Active.Value = true end) script.Parent.MouseHoverLeave:Connect(function(plr) game.Players[plr.Name].PlayerGui.InteractionMenu.Enabled = false script.Active.Value = false end) game:GetService("UserInputService").InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.F and script.Active == true and script.Parent.Parent.Parent.Panel.SurfaceGui.Control3.BackgroundColor3 == Color3.fromRGB(255, 0, 0) then script.Parent.Parent.Parent.Panel.SurfaceGui.Control3.BackgroundColor3 = Color3.fromRGB(255, 0, 0) end end)
Why won't it work? Bit of help please. Thx
Problem: Gui won't turn green on "F".
Solution: Use Color3.fromRGB(0, 255, 0)
.
Explanation: You made the script set the BackgroundColor3
to red (255, 0, 0) instead of green (0, 255, 0).
Fixed script:
script.Parent.MouseHoverEnter:Connect(function(plr) game.Players[plr.Name].PlayerGui.InteractionMenu.Enabled = true game.Players[plr.Name].PlayerGui.InteractionMenu.ItemName.Text = "Control Panel" game.Players[plr.Name].PlayerGui.InteractionMenu.HoldF.Text = "Hit [F] to open door" script.Active.Value = true end) script.Parent.MouseHoverLeave:Connect(function(plr) game.Players[plr.Name].PlayerGui.InteractionMenu.Enabled = false script.Active.Value = false end) game:GetService("UserInputService").InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.F and script.Active == true and script.Parent.Parent.Parent.Panel.SurfaceGui.Control3.BackgroundColor3 == Color3.fromRGB(255, 0, 0) then script.Parent.Parent.Parent.Panel.SurfaceGui.Control3.BackgroundColor3 = Color3.fromRGB(0, 255, 0) end end)
Please accept and upvote this answer if it helped.