Hslider just becomes unchangeable randomly

Godot Version

v4.1.3.stable.official [f06b6836a]


hi!! so for a project i am coding a poker game where before starting the game, you can determine the amount of ‘money’ each player starts with, and to do this i have been using a hSlider to choose how much that is. it initially works, as you can both use your mouse to drag the slider and scrollwheel to scroll the slider too. however, it just stops being editable at a point?? there isnt any reason why i can find why, the “editable” and “scrollable” tags don’t change, just that at a point they become inaffective and no longer work. this is my first time posting to the forums so im not entirely sure what the etiquette is on posting code or an image of the tags or anything like that but i am more than happy to provide anything that may help!

Can you post your scene tree and the code?

sure thing! (ignore literally EVERYTHING about the structure, i am kind of a teeny bit new to godot)

and here is the script associated with the Game Options Menu node:

extends Control

#variables for the paths of the options, to save retyping same code
@onready var pathPotSlider = “VBoxContainer/Initial Pot/VBoxContainer/HSlider”
@onready var pathPotLabel = “VBoxContainer/Initial Pot/VBoxContainer/Label”
@onready var pathPlayersDropDown = “VBoxContainer/Opponent Drop Down/OptionButton”
@onready var pathTimeDropDown = “VBoxContainer/Turn Length/OptionButton”

signal startGame(opponentNum, buyInAmount, turnLength)

func _on_start_game_pressed():
#unhides self
$“.”.visible = true

func _ready():

func _on_finished_pressed():
#when finished button is pressed, the start game signal is emitted which carries along
#number of opponents and the buy in amount.
#since the ids start at 0 and there is another player (YOU!) it adds 2 to compensate.
var opponentNum = get_node(pathPlayersDropDown).selected + 2
var buyInAmount = get_node(pathPotSlider).value
var turnLength = get_node(pathTimeDropDown).selected
startGame.emit(opponentNum, buyInAmount, turnLength)
#hides self
$“.”.visible = false

func _on_h_slider_value_changed(value):
get_node(pathPotLabel).text = str(get_node(pathPotSlider).value)

You may have some Control consuming the event. Try clicking on the HSlider when it’s not working while running the game and check which Control received the click in the Debugger dock under the Misc tab. Check if Last Clicked Control field is the one you are expecting it to be. If not, set that control Control.mouse_filter to Ignore or Pass and repeat.

1 Like

you meant during runtime randomly occur, or when you were adding new stuff on editor then you run it then try to slide it but cant, or the slider stop at specific point like 50% or 70% and cant move it anymore?

usually you cant interact with things on controls node like this is because the lower part in scene tree’s controls node or its child actually blocking the slider to get any input. check the inspector → control → mouse → filter, generally any new basic control node created having the filter to stop

1 Like

Some invisible control node just covers your slider at some point, consuming mouse inputs.

1 Like

thank you this worked wonders! i was hiding a start button which instead should have been removed and it happened to cover the parts of the scrollbar (and parts of some drop-down boxes) which explained it. thank you again!!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.