I am making a gun system and I am implementing shoot offset scaled by movement type for some reason it only prints “Standing shot” and “Walking shot”
My formatting is probably the problem but can someone help?
if isMoving == false then
if isCrouching.Value == false and isRunning.Value == false then
print("Standing shot")
elseif isCrouching.Value == true and isRunning.Value == false then
print("Crouching shot")
end
elseif isMoving == true then
if isCrouching.Value == false and isRunning.Value == false then
print("Walking shot")
elseif isCrouching.Value == true and isRunning.Value == false then
print("Crouchwalking shot")
elseif isCrouching.Value == false and isRunning.Value == true then
print("Sprinting shot")
end
end
(Note: isRunning and isCrouching are both working fine)
For the case that isMoving is false, there is no reason to check isRunning since they are not moving. That’s my guess for “Crouching shot” not showing up.
For crouching, the logic can be simplified. Here’s my suggestion:
if isMoving then
if isRunning.Value then
print("Sprinting shot")
elseif isCrouching.Value then
print("Crouchwalking shot")
else
print("Walking shot")
end
else
if isCrouching.Value then
print("Crouching shot")
else
print("Standing shot")
end
end
Note that I made the assumption that isRunning will not be true while you are crouching. Also I noticed, if “isMoving” is a value like the rest of the variables, you will need to check that with the Value property. I’m not sure if that was a typo, or it was just a boolean variable.
Both isCrouching and isRunning are boolean variables inside the character, whilst isMoving is a local variable that is set based of the humanoid’s magnitude.
Try printing isCrouching’s value to see if it is even being set. If not, it could be an issue with detecting the user’s input (which I’m assuming you’re using to crouch).
It could, but it depends. I believe values replicate from server to client, but if you’re changing the values on the client and checking them on the server, that won’t work.
I think sending over the raw values to the server and calculating them there would make them less exploitable, but either way would work fine. Just use a remote.