So I have been working on the input for this character I am making and S and D don't seem to work when I press them but W and A do so Idk what's going on. Here's the code
RunService.Heartbeat:Connect(function(step)
if CanMove2 == true then
print(true)
Tempman.Union.CFrame = Tempman.Union.CFrame * CFrame.new(0,0,0.5) -- This works fine
end
end)
RunService.Heartbeat:Connect(function(step)
if CanMove3 == true then
Tempman.Union.CFrame = Tempman.Union.CFrame * CFrame.new(0.5,0,0) -- This works fine
end
end)
RunService.Heartbeat:Connect(function(step)
if CanMove4 == true then
Tempman.Union.CFrame = Tempman.Union.CFrame * CFrame.new(0,0,-0.5) -- This doesn't work
end
end)
RunService.Heartbeat:Connect(function(step)
if CanMove5 == true then
print("Should work")
Tempman.Union.CFrame = Tempman.Union.CFrame * CFrame.new(-0.5,0,0) This doesn't work
end
end)
Move.OnServerEvent:Connect(function(person, key, Value)-- Key detection for all players
if Value == true and CanMove1 == true then
if key == W then
CanMove2 = true
print("Should be true")
elseif key == A then
CanMove3 = true
elseif key == S then
print(S)
print(key) -- S and key print out as the exact same thing here
local CanMove4 = true
elseif key == D then
local CanMove5 = true
print(D)
elseif key == Space then
print(Space)
local CanMove6 = true
end -- change this when you're gonna do more keys
elseif Value == false then
if key == W then
CanMove2 = false
elseif key == A then
CanMove3 = false
elseif key == S then
CanMove4 = false
elseif key == D then
CanMove5 = false
end
end
end)

2 comments
What happens is that you put a 'local' infront of CanMove4 and CanMove5, meaning youre making a new variable for that function and not the already existing one, you also put a 'local' before CanMove6
THANK YOU SO MUCH