Hello! I am trying to make a thing where once you press E it switches the text from "Normal" to "Sword" but for some reason anything i do in a localscript relating to GUI's seem to not work.
Does anyone know why its not working?
Local Script: (In StarterPlayerScripts)
local UIS = game:GetService("UserInputService")
local normalmoves = game.StarterGui.DefaultUI.Moves.NormalMoves:GetChildren()
local modetext = game.StarterGui.DefaultUI.Moves.Mode
local backpack = script.Parent.Parent:WaitForChild("Backpack")
mode = 1
UIS.InputBegan:Connect(function(input, busy)
if input.KeyCode == Enum.KeyCode.E and mode == 1 then
print("Player switched to sword mode")
modetext.Text = "Sword" -- This code doesnt work
mode = 2
elseif input.KeyCode == Enum.KeyCode.E and mode == 12 then
print("Player switched to Normal mode")
modetext.Text = "Normal" -- This code doesnt work
mode = 1
end
end)
I don't understand why anything i do GUI's doesnt work in a localscript
