No, that would not work. Let's highlight the reasons:
game.Players.LocalPlayer:GetMouse() .KeyDown:connect if string.lower (key) == "m" then Instance.new('Hint', Workspace) Hint.Text = "Just a test" end end)
From just looking at that code, you can see a few things.
- You do not properly use the RbxScriptSignal connection.
- You attempt to access key, a nil value.
- You try to set the Text property of Hint, also a nil value.
Now, let's fix those problems and clean up your code a little.
game.Players.LocalPlayer:GetMouse() .KeyDown:connect(function(key)
if key:lower() == "m" then
Instance.new('Hint', Workspace).Text = "Just a test";
end;
end);
Sources to learn from: http://wiki.roblox.com/index.php?title=RBXScriptSignal and http://wiki.roblox.com/index.php?title=Variables
3 comments
if should be on the 2nd line.,
And the ends should be on seperate lines
You should use the Lua button for multiline code display (it'll look like ~~~~ (newline) code code code (newline) ~~~~~~). The backticks are used for code interspersed with writing (inline code).