Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 5 years ago

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)

0
I know what video you got this off :) ScrubSadmir 200 — 5y

1 answer

Log in to vote
0
Answered by
HaveASip 494 Moderation Voter
5 years ago
Edited 5 years ago

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

0
it wont work :()( billyminecraft21 -3 — 5y
0
what type of script do you used? HaveASip 494 — 5y
0
local billyminecraft21 -3 — 5y
0
DO you have a discord i will send you a video on waht im trying to do billyminecraft21 -3 — 5y
View all comments (2 more)
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. SummerEquinox 643 — 5y
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. SummerEquinox 643 — 5y
Ad

Answer this question