So I started coding with Lua and GMOD yesterday. I do know what variables are, and all of that stuff (I’ve coded before), so no need to explain that. I’m new at Lua though, and these may be like REALLY simple solutions, but I need to get more familiar with the language and how to use it.
The problem is that, I’ve never coded with server side and client side, so I’m not sure how to do when doing stuff like this:
You can only change certain things on the server side, and I’m wondering how to implement a stamina system. I don’t know how to call on the player from the server side.
- ply = LocalPlayer() (clientside script), which leads me to the problem: “function arguments expected near ‘=’”. So, basically, I can’t use ply:stamina for example. How do I refer to the player?
1.5 If I somehow knew how to refer to the player/players, would it select ALL the players or just a client who for example like upgrade the stamina, or something like that. If I use localplayer, does it only select that player who did it?
- Can somebody show me how to for example write a stamina system that when if a players run the player loses stamina and when he’s out of stamina he can’t run anymore, or do any actions that require some stamina.
I know that I can maybe do like this:
if ply:KeyDown(some random key) and stamina >= 25 then
–Cast some spell idk
print(“You don’t have enough stamina”)
And for the final thing, if you have some tips for a beginner like me, I would really appreciate it if you would write some down.
Thanks in advance.