I am facing an issue. So I added a script that makes it so that when R is clicked a sword appears. I also added another one that makes it so that when F is clicked a GUI appears. Well the issue here is that now that I added the key that makes a GUI appear, when I click R a sword never appears. Please help me.
Here are my scripts:
This is the one for my sword
local BladeDash = game.StarterGui.Red.RedPower1.REDpower1
local toolclone = workspace.Tool:Clone()
--Script used to get sword--
function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
if BladeDash.Value == true then
local player = game.Players.LocalPlayer
local character = player.Character
character.Humanoid:EquipTool(toolclone)
else
print("FAIL")
end
end
end
game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.R)
And now here is the one to get the GUI to appear
local Red = game.StarterGui.Red.RedButton.RED
local player = game.Players.LocalPlayer
local character = player.Character
local morpher = player.PlayerGui.Red.Morpher
--scripts for showing GUI--
function onKeyPress(actionName, userInputState, inputObject)
if userInputState == Enum.UserInputState.Begin then
if Red.Value ==true then
morpher.Visible = true
end
end
end
game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.F)
