Ok so I would have 1 tool. I would put to RemoteEvent in each one. If I were too press "r" it would create a brick that is black. If i press "q" I would create a brick that is red. But for some reason when I for Ex. Press "q" before "r" the black brick would appear but the red one would never. Why?
Local script
--Local script-- Player = game.Players.LocalPlayer Mouse = Player:GetMouse() local en = true--Debounce-- Tool = script.Parent Tool.Equipped:Connect(function() Mouse.KeyDown:connect(function(Key) if Key == "e" then if not en then return end en = false Tool.RemoteEvent:FireServer(Key) end end) end)
Local script
--Local script-- Player = game.Players.LocalPlayer Mouse = Player:GetMouse() local en = true--Debounce-- Tool = script.Parent Tool.Equipped:Connect(function() Mouse.KeyDown:connect(function(Key) if Key == "r" then if not en then return end en = false Tool.RemoteEvent:FireServer(Key) end end) end)
Server script
--Server script-- script.Parent.RemoteEvent.OnServerEvent:Connect(function(Key) local Part = Instance.new("Part") Part.Parent = game.Workspace Part.BrickColor = BrickColor.new("Really red") end)
Server script
--Server script-- script.Parent.RemoteEvents.OnServerEvent:Connect(function(Key) local Part = Instance.new("Part") Part.Parent = game.Workspace Part.BrickColor = BrickColor.new("Really black") end)
Thanks for helping me
Mouse.KeyDown is deprecated and may soon not work. Use the context action service for setting keybinds, as it is more efficient and still supported compared to KeyDown:
https://wiki.roblox.com/index.php?title=API:Class/ContextActionService