Professional Documents
Culture Documents
Local PLR Game - Players.localplayefomfass
Local PLR Game - Players.localplayefomfass
LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
tool.Equipped:Connect(function()
game.ReplicatedStorage.ConnectM6D:FireServer(tool.BodyAttach)
char.Torso.ToolGrip.Part0 = char.Torso
char.Torso.ToolGrip.Part1 = tool.BodyAttach
equipped = true
idleAnim:Play()
end)
tool.Unequipped:Connect(function()
game.ReplicatedStorage.DisconnectM6D:FireServer()
equipped = false
idleAnim:Stop()
forwardAnim:Stop()
LeftAnim:Stop()
RightAnim:Stop()
JumpAnim:Stop()
end)
tool.Activated:Connect(function()
ShootAnim:Play()
wait(3)
ShootAnim:Stop()
end)
uis.InputBegan:Connect(function(key, chat)
if equipped then
if chat then return end
if key.KeyCode == Enum.KeyCode.W and equipped == true then
wPressed = true
forwardAnim:Play()
elseif key.KeyCode == Enum.KeyCode.S and equipped == true then
sPressed = true
forwardAnim:Play()
elseif key.KeyCode == Enum.KeyCode.A and equipped == true then
aPressed = true
LeftAnim:Play()
elseif key.KeyCode == Enum.KeyCode.D and equipped == true then
dPressed = true
RightAnim:Play()
elseif key.KeyCode == Enum.KeyCode.Space and equipped == true then
spPressed = true
JumpAnim:Play()
end
end
end)
uis.InputEnded:Connect(function(key, chat)
if chat then return end
if key.KeyCode == Enum.KeyCode.W then
wPressed = false
forwardAnim:Stop()
elseif key.KeyCode == Enum.KeyCode.S then
sPressed = false
forwardAnim:Stop()
elseif key.KeyCode == Enum.KeyCode.A then
aPressed = false
LeftAnim:Stop()
elseif key.KeyCode == Enum.KeyCode.D then
dPressed = false
RightAnim:Stop()
elseif key.KeyCode == Enum.KeyCode.Space then
spPressed = false
JumpAnim:Stop()
end
end)