Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Im pressing z and the word i put doesent show up on output can anyone help?

local repstore = game:WaitForChild("ReplicatedStorage") local Remote = repstore:WaitForChild("IceStart")

Player = game.Players.LocalPlayer Mouse = Player:GetMouse()

cool = true

Mouse.KeyDown:Connect(function(key) key = key:lower() if key == "z" then if cool ~= true then return end cool = false

print("Worked")

Remote:FireServer()

wait(5)
cool = true
end	

end)

1 comment

0

I know what video you got this off :)

1 answer

✓ Accepted answer

Hello your problem is very simple to fix. You just need to use UserInputService every time, cuz "Mouse.Keydown " is deprecated.

local repstore = game:GetService("ReplicatedStorage") 
local Remote = repstore:WaitForChild("IceStart")
local UIS = game:GetService("UserInputService")
cool = true

UIS.InputBegan:Connect(function(input) --fires when player inputed some key
	if input.UserInputType == Enum.UserInputType.Keyboard then -- checks if player inputed key using keyboard
		if input.KeyCode == Enum.KeyCode.Z and cool == true then -- checks if key z and cool = true       
cool = false
			print("Worked!")
			Remote:FireServer()
			wait(.5)
			cool = true
		end
	end
end)

P.S. Please put all your script in script block, not a half

6 comments

0

it wont work :()(

0

what type of script do you used?

0

local

0

DO you have a discord i will send you a video on waht im trying to do

0

Billy his code is fine. I just tested it and nullified the IceStart WaitForChild() with no issues. Put this code in a LocalScript - make sure nothing is infinite yielding, and beyond that there are no issues.

0

Also - there has recently been a push to mainstream ContextActionService due to its binding abilities. If you wanted you could use that instead of UserInputService.

This discussion is preserved as it was. New answers, comments, and votes are closed.