RobloxScripterAI
Discord ↗
Link Copied to Clipboard
×
"Player is not a valid member of Player "Players.Cth4n" erroring line 3"
-- The error is because you are trying to access the player's name directly from the click parameter which is not valid. You should use the click parameter to get the player who clicked. Here's the corrected code: -- local script local function onClick(player) local playerGui = player:WaitForChild("PlayerGui") if Settings.WhitelistedPlayers[player.Name] or player:IsInGroup(Settings.MinID) then if not playerGui:FindFirstChild("selectGUI") then local clonedGui = gui:Clone() clonedGui.Parent = playerGui toggleTween(clonedGui) local RedButton = clonedGui.ImageLabel.Red local BlueButton = clonedGui.ImageLabel.Blue local PurpleButton = clonedGui.ImageLabel.Purple local HexTextBox = clonedGui.ImageLabel:WaitForChild("HexTextBox") local ConfirmButton = clonedGui.ImageLabel.ConfirmButton local IncreaseButton = clonedGui.ImageLabel.BrightnessDisplay.Increase local DecreaseButton = clonedGui.ImageLabel.BrightnessDisplay.Decrease RedButton.MouseButton1Click:Connect(function() changeLightColor(Color3.fromRGB(255, 0, 0)) -- Red end) BlueButton.MouseButton1Click:Connect(function() changeLightColor(Color3.fromRGB(0, 0, 255)) -- Blue end) PurpleButton.MouseButton1Click:Connect(function() changeLightColor(Color3.fromRGB(128, 0, 255)) -- Purple (adjust RGB values as needed) end) local Increase = clonedGui.Increase local Decrease = clonedGui.Decrease Increase.OnServerEvent:Connect(function(player, brightnessValue) increaseBrightness(brightnessValue) end) Decrease.OnServerEvent:Connect(function(player, brightnessValue) decreaseBrightness(brightnessValue) end) local RemoteEvent = clonedGui.ChangeColor RemoteEvent.OnServerEvent:Connect(function(player, color) changeLightColor(color) end) local exitButton = clonedGui.ImageLabel.Exit exitButton.MouseButton1Click:Connect(function() clonedGui:Destroy() end) end end end script.Parent.ClickDetector.MouseClick:Connect(onClick)