It worked just fine in solo

the output says nothing, used to say "Stockoverlay is not a member of stockcore" even though it clearly was a member(and it was loaded btw) What is going on is this some kind of bug?

	sword = script.Parent.Sword
	script.Parent:WaitForChild("Stockoverlay")
	Overlay = script.Parent.Stockoverlay
	
function selected()

	if script.Parent.Selected.Value == false then
		script.Parent.Selected.Value = true
		script.Parent.Select:Play()
		sword.Parent = game.Players.LocalPlayer.Character
	for i = 0,1,0.1 do
		Overlay.ImageTransparency = Overlay.ImageTransparency - 0.1
		wait(0.01)
	end
	
	else
		script.Parent.Selected.Value = false
		sword.Parent = script.Parent
		script.Parent.Deselect:Play()
		for i = 0,1,0.1 do
			
	
		Overlay.ImageTransparency = Overlay.ImageTransparency + 0.1
		wait(0.01)
	end
	end
	
end

function onKeyPress(inputObject, gameProcessedEvent)
	if inputObject.KeyCode == Enum.KeyCode.One then
		print("NoireSword")
		selected()
	end
end

function onKeyPress2(inputObject, gameProcessedEvent)
	 if inputObject.KeyCode == Enum.KeyCode.Two  then
		deselect()
	end
	end

function deselect()
		if script.Parent.Selected.Value == true then

		script.Parent.Selected.Value = false
		sword.Parent = script.Parent
		script.Parent.Deselect:Play()
		for i = 0,1,0.1 do
		Overlay.ImageTransparency = Overlay.ImageTransparency + 0.1
		wait(0.01)
		end
		end
		end
 
game:GetService("UserInputService").InputBegan:connect(onKeyPress)
game:GetService("UserInputService").InputBegan:connect(onKeyPress2)

3 comments

0

Try putting it in a local script of already put it in a server script

0

Try a local script because using keydowns has to deal with a players keyboard do that's local

0

It already is