I'm using KeyCode so players can flip through a GUI. My script works in Solo mode only (the usual with FE lol). Here is my code, help would be greatly appreciated!

game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.Q then
		if SlotNum.Value <= 3 then
			SlotNum.Value = SlotNum.Value + 1
		elseif SlotNum.Value == 4 then
			SlotNum.Value = 1
		end
	elseif inputObject.KeyCode == Enum.KeyCode.E then
		if SlotNum.Value >= 2 then
			SlotNum.Value = SlotNum.Value - 1
		elseif SlotNum.Value == 1 then
			SlotNum.Value = 4
		end
	end
end)

EDIT: Another function is linked to the SlotNum Value that is located in the playergui that actually changed the color of the GUIs (although it works in solo mode so I doubt the issue lies here):

SlotNum.Changed:connect(function(newvalue)
	for i,v in ipairs(Slots:GetChildren()) do
		v.BackgroundColor3 = Color3.new(255, 255, 255)
	end
	if newvalue == 1 then
		Slots.A.BackgroundColor3 = Color3.new(0, 170, 255)
	elseif newvalue == 2 then
		Slots.B.BackgroundColor3 = Color3.new(0, 170, 255)
	elseif newvalue == 3 then
		Slots.C.BackgroundColor3 = Color3.new(0, 170, 255)
	elseif newvalue == 4 then
		Slots.D.BackgroundColor3 = Color3.new(0, 170, 255)
	end
end)

1 comment

0

Replication issues can not be easily diagnosed by anyone but yourself.